read golang source code by Visual Studio Code ,compiler warning,how to fix it

huangapple go评论97阅读模式
英文:

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,出现警告信息
read golang source code by Visual Studio Code ,compiler warning,how to fix it

read golang source code by Visual Studio Code ,compiler warning,how to fix it

我尝试打开 bufio
read golang source code by Visual Studio Code ,compiler warning,how to fix it

请问如何修复这个问题

英文:

download source code

git clone https://github.com/golang/go.git  golang


open golang by Visual Studio Code,the waring info
read golang source code by Visual Studio Code ,compiler warning,how to fix it

read golang source code by Visual Studio Code ,compiler warning,how to fix it

I try open bufio
read golang source code by Visual Studio Code ,compiler warning,how to fix it

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

huangapple
  • 本文由 发表于 2021年11月28日 20:51:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/70143575.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定