https://github.com/moovweb/gvm
安裝
1 2 3 4 5 6 7 8
| xcode-select --install brew update brew install mercurial bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer) gvm install go1.4 -B gvm use go1.4 export GOROOT_BOOTSTRAP=$GOROOT gvm install 1.8
|
指令
1 2 3 4 5 6
| gvm install [version] gvm uninstall [version] gvm listall gvm list gvm use [version] gvm implode // uninstall gvm
|
使用gvm來管理workspace
1 2 3 4 5 6 7
| go use [version] mkdir -p ~/golang/ cd ~/golang/ gvm pkgset create --local gvm pkgset use --local mkdir src pkg bin go env
|
利用pkgset將GOPATH設為自定的workspace path
vscode 整合
設定gopath與goroot為go env的值
1 2 3 4
| { "go.gopath":"/Users/meep007/cwz/develop/practice/golang:/Users/meep007/cwz/develop/practice/golang/.gvm_local/pkgsets/go1.8/local:/Users/meep007/.gvm/pkgsets/go1.8/global", "go.goroot": "/Users/meep007/.gvm/gos/go1.8" }
|
Comment and share