vscode 配置go開發環境
安裝vscode插件
Visual Studio Code的配置選項支持Go插件的設置,可以通過用戶偏好設置或workspace設置進行配置。在菜單File->Preferences處可以找到。
安裝go模塊
vscode 死活下不下來,只能自己去下載了
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-find-references
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
調試工具dlv debug下載
https://github.com/go-delve/delve
進入到gopath中,自己進行安裝go install
setting.json
打開工作區的json文件,將下列內容復制進去
{
"http.proxy": "http://127.0.0.1:7890",
"go.useLanguageServer": true,
"go.autocompleteUnimportedPackages": true,
"timeline.excludeSources": [],
"go.inferGopath": true,
"go.gotoSymbol.includeImports": true,
"go.useCodeSnippetsOnFunctionSuggest": true,
"go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
"go.docsTool": "gogetdoc",
"[go]": {
"editor.snippetSuggestions": "none",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"files.eol": "\n", // formatting only supports LF line endings
"emmet.excludeLanguages": [
"markdown"
],
"go.addTags": {
}
}