无法找到由asdf安装的”go”二进制文件。

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

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来解决了这个问题。

另一个人在这个问题中提出了一个解决方法,但我并不需要这样做。

  1. Shift + Cmd + P
  2. 搜索:"open settings",选择"Open Settings (JSON)"
  3. 运行 go env 并复制 GOROOT 的值(在我的情况下是 /opt/homebrew/Cellar/go/1.17.1/libexec)。
  4. 在 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.

  1. Shift + Cmd + P
  2. Search for: "open settings" and choose "Open Settings (JSON)"
  3. Run go env and copy GOROOT value (in my case it's /opt/homebrew/Cellar/go/1.17.1/libexec).
  4. 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"

huangapple
  • 本文由 发表于 2022年2月24日 01:15:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/71241347.html
匿名

发表评论

匿名网友

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

确定