Windows环境下vscode GO开发环境配置

一:下载地址

go环境包下载地址:https://golang.org/dl/

vscode软件下载地址:https://code.visualstudio.com/

二:下载完成后直接双击安装,默认安装目录C:/Go,cmd打开命令行工具,在提示符下输入go version显示如下:

Windows环境下vscode GO开发环境配置_第1张图片

 

三:配置环境变量,go工作目录gopath,设置:GOPATH=D:\GoPath,go项目都在这个路径下,

Windows环境下vscode GO开发环境配置_第2张图片

在GoPath下面建三个文件夹,用来安装go插件,

Windows环境下vscode GO开发环境配置_第3张图片

在src文件夹下面,Git Bash here,下载插件并且安装,

$ 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

下载其他模块,

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/[email protected]
go get github.com/golang/[email protected]
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的扩张插件,Windows环境下vscode GO开发环境配置_第4张图片

 在src文件夹下,新建go文件,f5刷新,

Windows环境下vscode GO开发环境配置_第5张图片

如果打开vscode显示,

Windows环境下vscode GO开发环境配置_第6张图片

 

点击install之后,

Windows环境下vscode GO开发环境配置_第7张图片

可以运行程序了。 

注:也可以直接拷贝一个gopath的文件夹,进行配置。下载网址:https://pan.baidu.com/s/11JoufyquAaciZ77O5h1G7w

你可能感兴趣的:(Go)