public
Last active

Settings for a good development environment for Go on Windows or for programs in general Include chocolatey for easy software installation

  • Download Gist
senv.bat
Batchfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
@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,127.0.0.1,%USERDOMAIN%
 
set HOME=%HOMEDRIVE%%HOMEPATH%
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 http://stackoverflow.com/questions/7949956/git-diff-not-working-terminal-not-fully-functional
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\go1.0.3.windows-amd64
 
call:cleanAddPath PATH "%GITROOT%\bin"
call:cleanAddPath PATH "%HGROOT%"
call:cleanAddPath PATH "%GOROOT%\bin"
call:cleanAddPath PATH "%GOPATH%\bin"
 
echo.%PATH%
 
doskey gl=git lg -20 --branches
doskey gla=git lg -20 --branches --all
 
# See more at: http://chocolatey.org/#sthash.TLzTeLAK.dpuf
doskey cinstc=@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && 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
set GOSUBLIMEROOT=%SUBLIMEROOT%\Data\Packages\GoSublime
if not exist "%GOSUBLIMEROOT%" git clone https://github.com/DisposaBoy/GoSublime "%GOSUBLIMEROOT%"
git --git-dir="%GOSUBLIMEROOT%/.git" --work-tree="%GOSUBLIMEROOT%" pull origin master
REM http://stackoverflow.com/questions/10438508/error6-while-trying-to-use-sublime-text-to-msbuild
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 http://stackoverflow.com/questions/12020152/how-to-keep-the-value-of-a-variable-outside-a-windows-batch-script-which-uses
:cleanAddPath -- remove %~2 from %~1, add it at the end of %~1
SETLOCAL ENABLEDELAYEDEXPANSION
set P=!%~1!
set P=!P:%~2=!
set P=!P:;;=;!
set P=!P!;%~2
set P=!P:;;=;!
(ENDLOCAL & REM.-- RETURN VALUES
SET "%~1=%P%"
)
exit /b
 
:end

set term=msys will avoid the msysgit error "Terminal is not fully functional" warning (http://code.google.com/p/msysgit/issues/detail?id=184)

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.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.