I was following the http://tour.golang.org/ untill I got to the third step about that tells you that you can install the gotour on your system. After that I've installed the go language with brew by:
brew install hg brew install go
Then I downloaded the gotour by:
go get code.google.com/p/go-tour/gotour
When I tried to launch the gotour it didnt recognise the command:
$ gotour -bash: gotour: command not found
and
$ go gotour
and
$ ./gotour
So I tried to see the go path and it was empty,
echo $GOPATH
so I defined the GOPATH:
GOPATH=/usr/local/Cellar/go/1.0.2/src/pkg/code.google.com/p/ export GOPATH
Now I can run the gotour by runing
./gotour
But I'm insecure about my go enviroment.. wasn't I suposed to be able to run gotour by
go run gotour
or just by typing (like is described on this website http://www.moncefbelyamani.com/how-to-install-the-go-tour-on-your-mac/):
gotour
I would like to know if i'm doing things the right way since I'm new to the go programing language.
When you install go, tour is not installed by default. You need to do a go get golang.org/x/tour/gotour . This downloads gotour in your workspace. If your GOPATH is unset, but default you may want to do ${GOPATH:-$HOME/go}/bin/gotour as it will work in either case.
13.1drawin-amd64. pkg for the system. Step 3: After downloading process, install the package on your system: Step 4: After completing the installation processes. Open a program known as Terminal(It is a command-line interface for macOS) to check whether Go install properly or not using the Golang version command.
See that: go get: installing executables with 'go get' in module mode is deprecated. To adjust and download dependencies of the current module, use 'go get -d'. To install using requirements of the current module, use 'go install'.
mkdir $HOME/Go mkdir -p $HOME/Go/src/github.com/user
export GOPATH=$HOME/Go export GOROOT=/usr/local/opt/go/libexec export PATH=$PATH:$GOPATH/bin export PATH=$PATH:$GOROOT/bin
brew install go
go get golang.org/x/tools/cmd/godoc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With