Skip to content

Instantly share code, notes, and snippets.

@akavel
Created November 6, 2013 11:42
Show Gist options
  • Save akavel/7334765 to your computer and use it in GitHub Desktop.
Save akavel/7334765 to your computer and use it in GitHub Desktop.
go-cmd.bat
@echo off
setlocal
:: EXAMPLE:
:: set GOPATH=c:\gopath1;c:\gopath2
:::::::: meat ::::::::
set GOROOT=%~dp0
:: get first element of GOPATH
set _tmp=%GOPATH:*;=%
call set GOPATH0=%%GOPATH:%_tmp%=%%
set GOPATH0=%GOPATH0:;=%
mkdir %GOPATH0% > nul 2>&1
:: add important folders to PATH
set PATH=%GOROOT%\bin;%GOPATH0%\bin;%PATH%
cmd /K "echo GOROOT=%GOROOT%"
endlocal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment