VSCode - go error: gopls was not able to find modules in your workspace

发布时间 2023-07-16 17:39:07作者: ZhangZhihuiAAA
gopls was not able to find modules in your workspace.
When outside of GOPATH, gopls needs to know which modules you are working on.
You can fix this by opening your workspace to a folder inside a Go module, or
by using a go.work file to specify multiple modules.
See the documentation for more information on setting up your workspace:
https://github.com/golang/tools/blob/master/gopls/doc/workspace.md.
 
Solution:
zzh@ZZHPC:~/zd/MyPrograms/Go$ go work init