go tool: no such tool "tour"
I'm trying out Go for the first time. I was following these docs and wanted to run the go tour locally, but I haven't figured out how to get it to work.
Where is the tool "tour" supposed to be found?
I'm on OSX 10.11.3, and I installed Go via Homebrew
my Go entries in .zshrc
export GOPATH=$HOME/code/Go
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
Solution 1:
tour
is not installed by default with an installation of go. You need to go get
it:
go get golang.org/x/tour/gotour
Docs: https://github.com/golang/tour/
Solution 2:
I had a problem too. This's my solution, on OSX let try
gotour
With version go1.8.1 darwin/amd64
Solution 3:
It works for me using go1.4, but not with go1.7. If you just run go tool
, it gives you a list of known tools. They seem to have removed it from tools.
$ gvm use go1.7
$ go tool
addr2line
api
asm
cgo
compile
cover
dist
doc
fix
link
nm
objdump
pack
pprof
trace
vet
yacc
$ gym use go1.4
$ go tool
6a
6c
6g
6l
addr2line
cgo
cover
dist
fix
nm
objdump
pack
pprof
tour # <--- here
vet
yacc
Solution 4:
Firstly, it is no longer gotour
. And secondly, for the time being, the tour package is located at: golang.org/x/website/tour
as opposed to what A Tour of Go Welcome Page says.
So, at least for now:
The correct way to get
tour is:
go get golang.org/x/website/tour
Or,
go install golang.org/x/website/tour@latest
After which you can run the command in the terminal:
$ tour
2021/06/22 17:46:48 Serving content from /home/user/go/pkg/mod/golang.org/x/website/[email protected]
2021/06/22 17:46:48 A browser window should open. If not, please visit http://127.0.0.1:3999
2021/06/22 17:46:52 accepting connection from: 127.0.0.1:33192
To find out where it has been installed, you can do which tour
:
$ which tour
/home/user/go/bin//tour
reference