Home >Backend Development >Golang >Why Does My Go Setup From Homebrew Cause Command Line Execution Issues?
You initially installed Go using Homebrew, a package manager for macOS. While Homebrew simplifies the installation process, it introduces a potential discrepancy between command line execution and expected behavior.
To resolve the issue you encountered, follow these steps:
mkdir $HOME/Go<br>mkdir -p $HOME/Go/src/github.com/user<br>
export GOPATH=$HOME/Go<br>export GOROOT=/usr/local/opt/go/libexec<br>export PATH=$PATH:$GOPATH/bin<br>export PATH=$PATH:$GOROOT/bin<br>
go get golang.org/x/tools/cmd/godoc<br>
After these steps, you can execute the gotour command by typing go run gotour. Additionally, you should also be able to launch it directly using gotour.
However, it's important to note that the installation method you used (Homebrew) may have modified your system paths and environment variables, potentially introducing potential conflicts. To avoid these issues and ensure the intended functionality, it's recommended to install Go from the official source at https://golang.org/dl/.
The above is the detailed content of Why Does My Go Setup From Homebrew Cause Command Line Execution Issues?. For more information, please follow other related articles on the PHP Chinese website!