[{ "resource": "/C:/myself/package main.go", "owner": "_generated_diagnostic_collection_name_#1", "severity": 8, "message": "gopls was not able to find modules in your workspace.\nWhen outside of GOPATH, gopls needs to know which modules you are working on.\nYou can fix this by opening your workspace to a folder inside a Go module, or\nby using a go.work file to specify multiple modules.\nSee the documentation for more information on setting up your workspace:\nhttps://github.com/golang/tools/blob/master/gopls/doc/workspace.md.", "source": "go list", "startLineNumber": 1, "startColumn": 1, "endLineNumber": 1, "endColumn": 13 }]
时间: 2023-08-16 07:10:33 浏览: 321
EZ-EDS V3.23.1.20171205.zip_EDS_EtherNet/IP_canopen_canopen eds_
5星 · 资源好评率100%
这是一个关于 gopls 的错误消息,它表示在您的工作空间中找不到模块。当在 GOPATH 之外时,gopls 需要知道您正在使用哪些模块。您可以通过将工作空间打开到 Go 模块中的文件夹,或者使用 go.work 文件来指定多个模块来解决此问题。请参阅文档以获取有关设置工作空间的更多信息:https://github.com/golang/tools/blob/master/gopls/doc/workspace.md。
阅读全文