转载自:https://blog.csdn.net/weixin_39428938/article/details/86246588git
可参考:https://blog.csdn.net/xiao_xia_ming/article/details/82831026github
一:下载地址golang
go环境包下载地址:https://golang.org/dl/工具
vscode软件下载地址:https://code.visualstudio.com/spa
二:下载完成后直接双击安装,默认安装目录C:/Go,cmd打开命令行工具,在提示符下输入go version显示以下:.net
三:配置环境变量,go工做目录gopath,设置:GOPATH=D:\GoPath,go项目都在这个路径下,插件
在GoPath下面建三个文件夹,用来安装go插件,命令行
在src文件夹下面,Git Bash here,下载插件而且安装,code
$ cd $GOPATH/src $ mkdir golang.org $ cd golang.org $ mkdir x $ cd x git clone https://github.com/golang/lint.git git clone https://github.com/golang/tools.git git clone https://github.com/golang/sys.git git clone https://github.com/golang/crypto.git git clone https://github.com/golang/net.git git clone https://github.com/golang/text.git git clone https://github.com/9fans/go D:/GoPath/src/9fans.net/go go get -u -v github.com/rogpeppe/godef cd $GOPATH/src/github.com/rogpeppe/godef go clean -r -i go install -v
下载其余模块,blog
go get github.com/golang/lint@master go get github.com/golang/tools@master go get github.com/golang/arch@master go get github.com/golang/sys@v0.0.0-20180905080454-ebe1bf3edb33 go get github.com/golang/crypto@v0.0.0-20180904163835-0709b304e793 go get github.com/golang/net@master go get -u -v github.com/nsf/gocode go get -u -v github.com/lukehoban/go-outline go get github.com/sirupsen/logrus go get github.com/9fans/go@master go get github.com/rogpeppe/godef go get github.com/lukehoban/go-find-references go install github.com/nsf/gocode go install github.com/zmb3/gogetdoc go install github.com/lukehoban/go-outline go install golang.org/x/tools/cmd/gorename go install github.com/tpng/gopkgs go install github.com/newhook/go-symbols go install golang.org/x/tools/cmd/guru go install github.com/rogpeppe/godef go get github.com/peterh/liner github.com/derekparker/delve/cmd/dlv go get sourcegraph.com/sqs/goreturns go install sourcegraph.com/sqs/goreturns
四:打开vscode,安装go的扩张插件,
在src文件夹下,新建go文件,f5刷新,
若是打开vscode显示,
点击install以后,
能够运行程序了。