Create a gist now

Instantly share code, notes, and snippets.

@VonC /senv.bat
Last active Oct 7, 2015

Settings for a good development environment for Go on Windows or for programs in general Include chocolatey for easy software installation
@echo off
REM if corporate environment, set your proxy
REM set HTTP_PROXY=http://username:password@proxy.corp:port
REM set HTTPS_PROXY=http://username:password@proxy.corp:port
REM set NO_PROXY=.corp,localhost,,%USERDOMAIN%
REM if corporate environment, set your HOME to an *external* backed-up drive
REM set HOME=Z:\
if not exist P:\ subst P: %HOME%\prog
REM if local dev only
rem if not exist P:\ subst P: %HOMEDRIVE%%HOMEPATH%\prog
rem if not exist P:\ subst P: %HOMEDRIVE%%HOMEPATH%\Documents\prog
rem if not exist P:\ subst P: %HOMEDRIVE%%HOMEPATH%\My Documents\prog
REM from
set term=msys
REM Make your HOME as small as possible (especially if %HOME% is your profile):
REM %PRG%: all the executble and installations (big, can be re-installed)
REM %HOME%\prog: all the data (smaller, need to be backed up)
set PRG=C:\prog
set GITROOT=%PRG%\git\PortableGit-1.8.0-preview20121022
set HGROOT=%PRG%\hg\Mercurial2.4.0
set GOPATH=%HOME%\prog\go\projects
set GOROOT=%PRG%\go\
call:cleanAddPath PATH "%GITROOT%\bin"
call:cleanAddPath PATH "%HGROOT%"
call:cleanAddPath PATH "%GOROOT%\bin"
call:cleanAddPath PATH "%GOPATH%\bin"
doskey gl=git lg -20 --branches
doskey gla=git lg -20 --branches --all
# See more at:
doskey cinstc=@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString(''))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
doskey cupc=cup chocolatey
set SUBLIMEROOT=%PRG%\Sublime_Text_2.0.1_x64
if not exist "%SUBLIMEROOT%\Data\Packages" md %SUBLIMEROOT%\Data\Packages
if not exist "%GOSUBLIMEROOT%" git clone "%GOSUBLIMEROOT%"
git --git-dir="%GOSUBLIMEROOT%/.git" --work-tree="%GOSUBLIMEROOT%" pull origin master
REM avoid the "[Error 6] The handle is invalid" or "[Error 6] Le descripteur est invalide"
doskey gst=start "Sublime Text 2" "%SUBLIMEROOT%\sublime_text.exe" $*
set GOIDEROOT=%PRG%\go\liteide
doskey gid=start "GO IDE" "%GOIDEROOT%\bin\liteide.exe" $*
doskey npp="C:\Program Files (x86)\Notepad++\notepad++.exe" $*
REM if you have clearcase
REM doskey ct=cleartool $*
REM doskey mt=multitool $*
call:cleanAddPath PATH "%PRG%\Gow\bin"
goto end
REM from
:cleanAddPath -- remove %~2 from %~1, add it at the end of %~1
set P=!%~1!
set P=!P:%~2=!
set P=!P:;;=;!
set P=!P!;%~2
set P=!P:;;=;!
SET "%~1=%P%"
exit /b

set term=msys will avoid the msysgit error "Terminal is not fully functional" warning (


GOPATH must reference a path where there are the directories src, pkg, bin.


Starting 565eaa, this won't pollute your %PATH% with multiple duplicated paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment