工作之余突然又有兴趣学习一下golang,这里记录一下我在搭建安装环境遇到的问题。
1. 去https://golang.google.cn/dl/ 下载一个windows 安装包吧
2. go tools, 其实这是最蛋疼的地方。感谢伟大的墙。 我写了个win_go.bat 文件,安装好go之后,直接运行就可以了。
set GO111MODULE=on
set GOPROXY=https://goproxy.iogo get -u -v github.com/golang/sys
go get -u -v github.com/golang/net
go get -u -v github.com/golang/syncREM go get -u -v github.com/golang/lint
REM go get -u -v github.com/golang/lint/golint
go get -u -v github.com/go-delve/delve/cmd/dlv
go get -u -v github.com/kisielk/errcheckgo get -u -v github.com/jstemmer/gotags
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/zmb3/gogetdocREM go get -u -v github.com/nsf/gocode
go get -u -v github.com/mdempsky/gocode
go build -o %GOPATH%/bin/gocode-gomod.exe github.com/stamblerre/gocodeREM go get -u -v github.com/tpng/gopkgs
REM go get -u -v github.com/uudashr/gopkgs/cmd/gopkgs
go get -u -v github.com/uudashr/gopkgs/cmd/gopkgsgo get -u -v github.com/newhook/go-symbols
REM go get -u -v github.com/lukehoban/go-outline
go get -u -v github.com/ramya-rao-a/go-outlinego get -u -v golang.org/x/tools/cmd/gorename
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v golang.org/x/tools/cmd/getgo
go get -u -v golang.org/x/tools/cmd/godoc
go get -u -v golang.org/x/tools/cmd/goimports
go get -u -v golang.org/x/lint
go get -u -v golang.org/x/lint/golintgo get -u -v sourcegraph.com/sqs/goreturns
3. 安装vsc的 go extension, 愉快地编程吧。
ps: 学会go module, 不要在%GOPATH% 里面做开发。