- 首先安装vscode
- git golang 都装好
- 在命令行输入如下命令
go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
go get -u -v golang.org/x/tools/cmd/guru
golang.org/x/src/golang.org/x/go getgo install.vscodelaunch.jsonsetting.jsonlaunch.json
setting.json
{
"files.autoSave": "onFocusChange",
"go.buildOnSave": true,
"go.lintOnSave": true,
"go.vetOnSave": true,
"go.buildTags": "",
"go.buildFlags": [],
"go.lintFlags": [],
"go.vetFlags": [],
"go.coverOnSave": false,
"go.useCodeSnippetsOnFunctionSuggest": false,
"go.formatOnSave": true,
"go.formatTool": "goreturns",
"go.goroot": "$GOROOT",
"go.gopath": "$GOPATH",
"go.gocodeAutoBuild": true
}
或者使用Vscode提供的插件的默认配置,会出现某些bin安装失败的情况,操作同上。就可以有完美的golang开发环境了。
图片.png