【golang】golang1.16之vscode环境配置

最近更新的最新的golang版本go version go1.16.4 windows/amd64

关于不带 @version 的 go install

在模块外,不带 @version 是无法安装的,在安装插件的时候会有如下错误:

D:\go>go install github.com/ramya-rao-a/go-outline
go install: version is required when current directory is not in a module
        Try 'go install github.com/ramya-rao-a/go-outline@latest' to install the latest version

根据提示,我们加上了@latest作为版本号还是失败。

D:\go\src>go install github.com/mdempsky/gocode@latest
go install github.com/mdempsky/gocode@latest: no matching versions for query "latest"

解决办法:try go get -u -v

D:\go\src>go get -u -v github.com/mdempsky/gocode
go: downloading github.com/mdempsky/gocode v0.0.0-20200405233807-4acdcbdea79d
go: downloading golang.org/x/tools v0.1.1
golang.org/x/tools/go/internal/gcimporter
github.com/mdempsky/gocode/internal/lookdot
github.com/mdempsky/gocode/internal/suggest
golang.org/x/tools/go/gcexportdata
github.com/mdempsky/gocode/internal/cache
github.com/mdempsky/gocode/internal/gbimporter
github.com/mdempsky/gocode

D:\go\src>go install github.com/mdempsky/gocode@latest
go: finding module for package golang.org/x/tools/go/gcexportdata
go: found golang.org/x/tools/go/gcexportdata in golang.org/x/tools v0.1.1

再去看D:\go\bin可以看到gocode.exe已安装


1621413060.png

参考:https://blog.csdn.net/love666666shen/article/details/104382356
尚未解决的问题
go install github.com/stamblerre/gocode
go install github.com/mdempsky/gocode两个冲突的问题

你可能感兴趣的:(【golang】golang1.16之vscode环境配置)