<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/.
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3