0.VSCode无法安装Golang包

0.VSCode无法安装Golang包

2021.6.28
https://github.com/goproxy/goproxy.cn/blob/master/README.zh-CN.md
当出现Installing github.com/fatih/gomodifytags FAILED之类的情况时候,访问以上网址。输入以下配置

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

可以完成安装。

Tools environment: GOPATH=C:\Users\29456\go
Installing 10 tools at C:\Users\29456\go\bin in module mode.
  gopkgs
  go-outline
  gotests
  gomodifytags
  impl
  goplay
  dlv
  dlv-dap
  staticcheck
  gopls

Installing github.com/ramya-rao-a/go-outline (C:\Users\29456\go\bin\go-outline.exe) SUCCEEDED

All tools successfully installed. You are ready to Go :).
Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs (C:\Users\29456\go\bin\gopkgs.exe) SUCCEEDED
Installing github.com/ramya-rao-a/go-outline (C:\Users\29456\go\bin\go-outline.exe) SUCCEEDED
Installing github.com/cweill/gotests/gotests (C:\Users\29456\go\bin\gotests.exe) SUCCEEDED
Installing golang.org/x/tools/gopls (C:\Users\29456\go\bin\gopls.exe) SUCCEEDED

All tools successfully installed. You are ready to Go :).
Installing github.com/fatih/gomodifytags (C:\Users\29456\go\bin\gomodifytags.exe) SUCCEEDED
Installing github.com/josharian/impl (C:\Users\29456\go\bin\impl.exe) SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay (C:\Users\29456\go\bin\goplay.exe) SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv (C:\Users\29456\go\bin\dlv.exe) SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv@master (C:\Users\29456\go\bin\dlv-dap.exe) SUCCEEDED
Installing honnef.co/go/tools/cmd/staticcheck (C:\Users\29456\go\bin\staticcheck.exe) SUCCEEDED
Installing golang.org/x/tools/gopls (C:\Users\29456\go\bin\gopls.exe) SUCCEEDED

All tools successfully installed. You are ready to Go :).


当出现go: go.mod file not found in current directory or any parent directory; see 'go help modules'情况的时候。
在cmd里键入go env -w GO111MODULE=off即可成功运行。
来源https://stackoverflow.com/questions/66894200/go-go-mod-file-not-found-in-current-directory-or-any-parent-directory-see-go

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容