我使用 asdf
安装 Go 后,尝试打开一个 Go 项目时,遇到了以下错误:
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.
我使用 asdf
安装 Go 后,尝试打开一个 Go 项目时,遇到了以下错误:
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.
我通过重新启动VSCode来解决了这个问题。
另一个人在此问题中也提出了一种修复方法,但我并不需要这样做。
go env
命令并复制 GOROOT 的值(在我的情况下是 /opt/homebrew/Cellar/go/1.17.1/libexec
)。"go.goroot": "Copied/GOROOT/path",
在我的情况下,它是:
"go.goroot": "/opt/homebrew/Cellar/go/1.17.1/libexec"