Golang 新手可能会踩的 50 个坑

1.Error loading workspace: gopls requires a module at the root of your workspace

vscode 升级 gopls 到最新版本 v0.6.4 后出现以下提示:

Error loading workspace: gopls requires a module at the root of your workspace. …

  • 方法一
    将 gopls 的版本回退到 v0.5.5 可以解决。
GO111MODULE=on go get golang.org/x/tools/gopls@v0.5.5
  • 方法二
    settings.json 中添加如下配置:
"gopls": {
    "experimentalWorkspaceModule": true
},

2.go: go.mod file not found in current directory or any parent directory; see 'go help modules' Build

go mod初探及踩坑

3.vscode关于go语言的settings.json文件内容

https://blog.csdn.net/GeMarK/article/details/90269561

相关文章:

  • 2022-01-15
  • 2021-07-22
  • 2022-12-23
  • 2021-09-26
  • 2021-12-19
  • 2021-10-19
  • 2021-04-26
猜你喜欢
  • 2021-06-10
  • 2022-12-23
  • 2021-10-28
  • 2022-02-17
  • 2022-12-23
  • 2022-01-12
  • 2021-08-18
相关资源
相似解决方案