Installing Go with Homebrew and Running Gotour
For new users, setting up a Go environment can be a confusing process. This guide will provide a detailed walkthrough on installing Go with Homebrew and resolving common issues with running Gotour.
Installing Go
-
Create Directories:
- mkdir $HOME/Go
- mkdir -p $HOME/Go/src/github.com/user
-
Setup Paths:
- export GOPATH=$HOME/Go
- export GOROOT=/usr/local/opt/go/libexec
- export PATH=$PATH:$GOPATH/bin
- export PATH=$PATH:$GOROOT/bin
-
Install Go Homebrew:
-
Get Basics:
- go get golang.org/x/tools/cmd/godoc
Running Gotour
-
Install Gotour:
- go get code.google.com/p/go-tour/gotour
-
Set $GOPATH:
-
Run:
- Run Gotour with ./gotour (only when $GOPATH is set)
Expected Behavior
With this setup, you should be able to:
-
Run:
- go run gotour
- gotour (when in the Gotour directory)
Troubleshooting
- If you still encounter the "command not found" error, ensure that $GOPATH is correctly set and in your PATH.
- If you are unsure about your Go environment, consult the official documentation at https://golang.org/doc/code.html
The above is the detailed content of How to Install Go with Homebrew and Run Gotour?. For more information, please follow other related articles on the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn