vscode配置golang开发环境

一、安装 VSCode 和 Golang

二、在 go module 模式下加载工具包

mkdir test
cd test
go mod init test

三、配置代理

// set GOPROXY=https://proxy.golang.org
set GOPROXY=https://mirrors.aliyun.com/goproxy/

// GO 1.13+
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy,direct
go env -w GOSUMDB=sum.golang.google.cn

四、下载依赖包

go get github.com/stamblerre/gocode
rename %GOPATH%/gocode.exe %GOPATH%/gocode-gomod.exe

go get github.com/mdempsky/gocode
go get github.com/uudashr/gopkgs/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/go-delve/delve/cmd/dlv
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