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.
I fixed this by just restarting VSCode.
Another person also suggest a fix in this issue which I didn't need to do.
go env
and copy GOROOT value (in my case it's /opt/homebrew/Cellar/go/1.17.1/libexec
)."go.goroot": "Copied/GOROOT/path",
in my case it's:
"go.goroot": "/opt/homebrew/Cellar/go/1.17.1/libexec"
Newer versions of Go/Brew, the path will be different. This is what your settings.json would look like:
"go.alternateTools": {
"go": "/opt/homebrew/bin/go"
}