英文:
read golang source code by Visual Studio Code ,compiler warning,how to fix it
问题
下载源代码
git clone https://github.com/golang/go.git golang
使用 Visual Studio Code 打开 golang,出现警告信息
请问如何修复这个问题
英文:
download source code
git clone https://github.com/golang/go.git golang
open golang by Visual Studio Code,the waring info
so how to fix it
答案1
得分: 3
根据你的错误信息中给出的链接:
设置工作区
从2021年1月开始,如果你正在使用多个模块或嵌套模块进行工作,你需要为每个模块创建一个"工作区文件夹"。这意味着每个模块都有自己的作用域,功能在模块之间不会起作用。我们目前正在解决这个限制问题--请参阅下面关于实验性工作区模块模式的详细信息。
在VS Code中,你可以通过设置多根工作区来创建一个工作区文件夹。查看你的编辑器插件文档,了解如何在编辑器中配置工作区文件夹。
然后按照这个链接:
多根工作区
你将看到如何将文件夹添加到工作区。所以在VS Code中,通过以下步骤解决问题:
文件 > 添加文件夹到工作区 > "选择所需的文件夹"
然而,我觉得你正在尝试从源代码安装Go。如果是这样,你应该严格按照文档进行操作,并在你的GOROOT目录下执行安装:
从源代码安装Go
在文档的all.bash脚本中,你会看到如下一行:
echo 'all.bash must be run from $GOROOT/src' 1>&2
或者,如果你想要为Go源代码做贡献,可以参考以下文档:
贡献指南
英文:
Following the given link in your error:
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.
And then following this link:
multi-root workspace
You will see how to add a folder to the workspace.
So basically doing this at VS Code, solved the problem:
File > Add Folder To Workspace > "select the desired folders"
However, it seems to me that what you are trying to do is to install Go from source. If that is what you are aiming to, you should strictly follow the documentation and execute this installation at your GOROOT:
Install-Go-From-Source
At the all.bash script in the documentation you will see a line like this:
echo 'all.bash must be run from $GOROOT/src' 1>&2
Or follow this docs if you want to contribute with Go source code:
Contribution Guidelines
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论