How to make "godoc" command work on my system?
As has been pointed out by others some changes in Go 1.2 have caused the debian package maintainers to make some changes. The current way to install godoc is
sudo apt-get install golang-go.tools
This is because the Go developers moved godoc out of the normal distribution and into the go.tools subrepo. This subrepo is updated more frequently and has different rules for backwards compatibility.
Old answer:
It looks like you installed from the ubuntu package. You need to install golang-doc package in order to use godoc. This is installed automatically if you install the golang metapackage.
sudo apt-get install golang
If you use packages to install Go, I also recommend installing from the gophers PPA. Current packages are very old. The current is 1.0.2 when 1.0.3 was the final 1.0 release and 1.1 is the current version number. Details can be found at https://wiki.ubuntu.com/Go.
Simplest way:
First, install
godoc
with following command:go get golang.org/x/tools/cmd/godoc
Start
godoc
server:godoc -http=:6060
In your browser, visit:
http://localhost:6060
Install godoc by using go install
go install -v golang.org/x/tools/cmd/godoc@latest