Vscode 工作空间有多个 Go 模块时报错

gopls requires a module at the root of your workspace.
You can work with multiple modules by opening each one as a workspace folder.
Improvements to this workflow will be coming soon, and you can learn more here:
https://github.com/golang/tools/blob/master/gopls/doc/workspace.md.go list

image.png

解决方式:

ctrl+shift+p 输入命令 >setting
image.png
设置 vscode setting.json 添加参数 gopls

  1. {
  2. "gopls": {
  3. "experimentalWorkspaceModule": true
  4. }
  5. }