Windows環境下vscode GO開發環境配置

轉載自: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以後,

能夠運行程序了。 

相關文章
相關標籤/搜索