英文:
Cannot find "go" binary installed by asdf
问题
在使用asdf
安装Go并尝试打开Go项目后,我遇到了以下错误:
在GOROOT()或PATH(/usr/bin:/bin:/usr/sbin:/sbin)中找不到"go"二进制文件。请检查PATH,或安装Go并重新加载窗口。
英文:
I get the following error after installing Go with asdf
and trying to open a Go project.
Failed to find the "go" binary in either。GOROOT() or PATH(/usr/bin:/bin:/usr/sbin:/sbin). Check PATH, or Install Go and reload the window.
答案1
得分: 7
我通过重新启动VSCode来解决了这个问题。
另一个人在这个问题中提出了一个解决方法,但我并不需要这样做。
- Shift + Cmd + P
- 搜索:"open settings",选择"Open Settings (JSON)"
- 运行
go env
并复制 GOROOT 的值(在我的情况下是/opt/homebrew/Cellar/go/1.17.1/libexec
)。 - 在 settings.json 中添加新的记录:
"go.goroot": "复制的GOROOT路径",
在我的情况下是:
"go.goroot": "/opt/homebrew/Cellar/go/1.17.1/libexec"
英文:
I fixed this by just restarting VSCode.
Another person also suggest a fix in this issue which I didn't need to do.
- Shift + Cmd + P
- Search for: "open settings" and choose "Open Settings (JSON)"
- Run
go env
and copy GOROOT value (in my case it's/opt/homebrew/Cellar/go/1.17.1/libexec
). - Add new record to settings.json:
"go.goroot": "Copied/GOROOT/path",
in my case it's:
"go.goroot": "/opt/homebrew/Cellar/go/1.17.1/libexec"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论