微软发布的visual code studio是款简单易用的轻量级IDE,支持众多语言,包括Go语言。
通过extensions:install extensions安装了Go语言支持插件后,还需要安装gopls、gocode等依赖,因为golang.org无法直接访问,所以有时需要通过GitHub下载后手工安装依赖。简单如下:
#安装guru和gorename
git clone https://github.com/golang/tools.git "%GOPATH%\src\golang.org\x\tools"
go install golang.org/x/tools/cmd/guru
go install golang.org/x/tools/cmd/gorename
#安装golint
git clone https://github.com/golang/lint.git "%GOPATH%\src\golang.org\x\lint"
go install golang.org/x/lint/golint
#安装gopls
git clone https://github.com/sergi/go-diff.git "%GOPATH%\src\github.com\sergi\go-diff"
git clone https://github.com/golang/mod.git "%GOPATH%\src\golang.org\x\mod"
git clone https://github.com/golang/sync.git "%GOPATH%\src\golang.org\x\sync"
git clone https://github.com/golang/xerrors.git "%GOPATH%\src\golang.org\x\xerrors"
git clone https://github.com/dominikh/go-tools.git "%GOPATH%\src\honnef.co\go\tools"
git clone https://github.com/BurntSushi/toml.git "%GOPATH%\src\github.com\BurntSushi\toml"
git clone https://github.com/mvdan/xurls.git "%GOPATH%\src\github.com\mvdan\xurls"
#安装gocode
git clone https://github.com/mdempsky/gocode.git "%GOPATH%\src\github.com\mdempsky\gocode"
go install github.com/mdempsky/gocode
#安装go-outline
git clone https://github.com/ramya-rao-a/go-outline.git "%GOPATH%\src\github.com\ramya-rao-a\go-outline"
go install github.com/ramya-rao-a/go-outline
#安装gopkgs
git clone https://github.com/uudashr/gopkgs.git "%GOPATH%\src\github.com\uudashr\gopkgs"
git clone https://github.com/karrick/godirwalk.git "%GOPATH%\src\github.com\karrick\godirwalk"
git clone https://github.com/pkg/errors.git "%GOPATH%\src\github.com\pkg\errors"
go install github.com/uudashr/gopkgs/cmd/gopkgs
#安装go-symbols
git clone https://github.com/acroca/go-symbols.git "%GOPATH%\src\github.com\acroca\go-symbols"
go install github.com/acroca/go-symbols
#安装godef
git clone https://github.com/rogpeppe/godef.git "%GOPATH%\src\github.com\rogpeppe\godef"
go install github.com/rogpeppe/godef
#安装goreturns
git clone https://github.com/sqs/goreturns.git "%GOPATH%\src\github.com\sqs\goreturns"
go install github.com/sqs/goreturns
安装完成后,会在%GOPATH%\bin目录下,生成可执行文件:
go-outline.exe
go-symbols.exe
gocode.exe
godef.exe
golint.exe
gopkgs.exe
gopls.exe
gopls.exe~
gorename.exe
goreturns.exe
guru.exe
有疑问加站长微信联系(非本文作者)