最佳答案
按照错误中给定的链接进行操作: Setting up your workspace
As of Jan 2021, if you are working with multiple modules or nested modules, you will need to create a "workspace folder" for each module. This means that each module has its own scope, and features will not work across modules. We are currently working on addressing this limitation--see details about experimental workspace module mode below.
In VS Code, you can create a workspace folder by setting up a multi-root workspace. View the documentation for your editor plugin to learn how to configure a workspace folder in your editor.
然后点击此链接: multi-root workspace
您将看到如何将文件夹添加到工作区。 所以基本上在 VS Code 中这样做,解决了问题:
文件 > 将文件夹添加到工作区 >“选择所需的文件夹”
但是,在我看来,您想要做的是从源代码安装 Go。如果这就是您的目标,您应该严格遵循文档并在您的 GOROOT 上执行此安装: Install-Go-From-Source
在文档中的 all.bash 脚本中,您将看到如下行:
echo 'all.bash must be run from $GOROOT/src' 1>&2
或者如果您想贡献 Go 源代码,请遵循此文档: Contribution Guidelines
关于go - 通过Visual Studio Code读取golang源代码,编译器警告,如何修复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70143575/