I am trying to install package using go with below command:
go install fyne.io/fyne/v2/cmd/fyne@latest
This is the same as what the instruction said but ideally it should return below message
Users/name/go/bin/fyne
But when I enter the command it has below issue
fyne not found
The package author told me You likely don’t have the GOBIN path added to your PATH variable. I suspect it is golang/go#39531 that comes back to bite you.
When I execute export in the command line:
export
I am getting the below Golang path:
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin
I thought the path above was messed up because I have done multiple times of installing and uninstalling with uninstalling using below commands
I've done uninstall via:
$ sudo rm -rf /usr/local/go
$ sudo rm /etc/paths.d/go
Althought I've tried to change via:
vim ~/.zshrc
Add a line
export PATH=$PATH:$(go env GOPATH)/bin
It's still not working.
What’s the best approach to resolve adding GOBIN to path?
Thanks!
If all you need is to add
GOBINtoPATH, do:Since
GOBINoften is~/go/bin, you usually could get away with just:You can add that command to
~/.zshrcto make it persistent and then source it to execute it immediately:After that, if your shell remains unable to find
fyne, check that currentPATHcontent includesGOBINwith:If it doesn't, something went wrong when adding
GOBINtoPATH.