vscode 打造go开发环境

环境设置如下:

$ go env set GO111MODULE=on set GOPATH=D:\go set GOPROXY=http://xx.com.cn/goproxy set GOROOT=D:\software\go set GOSUMDB=off

安装go插件:
go get github.com/mdempsky/gocode go get github.com/uudashr/gopkgs/v2/cmd/gopkgs go get github.com/ramya-rao-a/go-outline go get github.com/acroca/go-symbols go get golang.org/x/tools/cmd/guru go get golang.org/x/tools/cmd/gorename go get github.com/cweill/gotests/... go get github.com/fatih/gomodifytags go get github.com/josharian/impl go get github.com/davidrjenni/reftools/cmd/fillstruct go get github.com/haya14busa/goplay/cmd/goplay go get github.com/go-delve/delve/cmd/dlv go get github.com/stamblerre/gocode go get github.com/rogpeppe/godef go get golang.org/x/tools/cmd/goimports go get golang.org/x/lint/golint go get golang.org/x/tools/gopls

【vscode 打造go开发环境】执行完上面操作后请重新打开一下vscode
查看安装的程序
$ D:\go\bin -rwxr-xr-x 1 root 1049089 14965760 Jul 2 11:31 dlv.exe* -rwxr-xr-x 1 root 1049089 6601216 Aug 21 15:44 fillstruct.exe* -rwxr-xr-x 1 root 1049089 4441088 Aug 21 15:05 go-outline.exe* -rwxr-xr-x 1 root 1049089 4240384 Aug 21 15:05 go-symbols.exe* -rwxr-xr-x 1 root 1049089 11719680 Aug 21 15:05 gocode.exe* -rwxr-xr-x 1 root 1049089 5746176 Aug 21 15:05 godef.exe* -rwxr-xr-x 1 root 1049089 15696896 Aug 21 15:06 godoc.exe* -rwxr-xr-x 1 root 1049089 7433728 Aug 21 15:07 gogetdoc.exe* -rwxr-xr-x 1 root 1049089 7931904 Aug 21 15:25 goimports.exe* -rwxr-xr-x 1 root 1049089 6126592 Aug 21 15:06 golint.exe* -rwxr-xr-x 1 root 1049089 6409728 Aug 21 15:49 gometalinter.exe* -rwxr-xr-x 1 root 1049089 4525568 Aug 21 15:07 gomodifytags.exe* -rwxr-xr-x 1 root 1049089 5326336 Aug 21 15:38 gopkgs.exe* -rwxr-xr-x 1 root 1049089 6258688 Aug 21 15:36 goplay.exe* -rwxr-xr-x 1 root 1049089 6097920 Aug 21 15:11 gorename.exe* -rwxr-xr-x 1 root 1049089 8473088 Aug 21 15:27 goreturns.exe* -rwxr-xr-x 1 root 1049089 12119552 Aug 21 15:30 gotests.exe* -rwxr-xr-x 1 root 1049089 9060864 Aug 21 15:31 guru.exe* -rwxr-xr-x 1 root 1049089 7678464 Aug 21 15:34 impl.exe*

settings.json
{ ?"go.formatTool": "goimports", ?"go.useLanguageServer": true, ?"[go]": { ?"editor.snippetSuggestions": "none", ?"editor.formatOnSave": true, ?"editor.codeActionsOnSave": { ?"source.organizeImports": true ?} ?}, ?"go.languageServerExperimentalFeatures": { ?"format": true, ?"autoComplete": true, ?"rename": true, ?"goToDefinition": true, ?"hover": true, ?"signatureHelp": true, ?"goToTypeDefinition": true, ?"goToImplementation": true, ?"documentSymbols": true, ?"workspaceSymbols": true, ?"findReferences": true, ?"diagnostics": false ?}, }

    推荐阅读