<h2>Brew Go Setup vs. Command Line Execution</h2>
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:
<h3>1. Create Necessary Directories</h3>
<pre>mkdir $HOME/Go
mkdir -p $HOME/Go/src/github.com/user
</pre>
<h3>2. Configure Environment Variables</h3>
<pre>export GOPATH=$HOME/Go
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
</pre>
<h3>3. Install Godoc</h3>
<pre>go get golang.org/x/tools/cmd/godoc
</pre>
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/.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3