Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find "go" binary installed by asdf

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.
like image 460
Kyle Venn Avatar asked Jul 14 '26 02:07

Kyle Venn


1 Answers

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"

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"
}
like image 127
Kyle Venn Avatar answered Jul 17 '26 22:07

Kyle Venn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!