xpt xpt - 1 year ago 397
Linux Question

offline document for go/golang

Is there any Ubuntu go offline document package that I can install so that I can read the package docs for Go offline?

I thought it would be

but it is actually not -- no any Go package docs in it.

Then I research further and tired

godoc -http=:6060

but visiting gives me

lstat /usr/lib/go/doc: no such file or directory

How to read the Go package docs offline?

PS. My Ubuntu and golang-go package:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 15.04
Release: 15.04
Codename: vivid

$ apt-cache policy golang-go
Installed: 2:1.4.2
Candidate: 2:1.4.2
Version table:
*** 2:1.4.2 0
500 http://ppa.launchpad.net/evarlast/golang1.4/ubuntu/ vivid/main amd64

Answer Source

According to Installing Go from source:

The source code for several Go tools (including godoc) is kept in the go.tools repository. To install all of them, run the go get command:

$ go get golang.org/x/tools/cmd/...

Or if you just want to install a specific command (godoc in this case):

$ go get golang.org/x/tools/cmd/godoc

To install these tools, the go get command requires that Git be installed locally.

You must also have a workspace (GOPATH) set up; see How to Write Go Code for the details.

Note: The go command will install the godoc binary to $GOROOT/bin (or $GOBIN) and the cover and vet binaries to $GOROOT/pkg/tool/$GOOS_$GOARCH. You can access the latter commands with "go tool cover" and "go tool vet".

Based on that information, have you tried:

  1. Installing godoc using $ go get golang.org/x/tools/cmd/godoc
  2. Verifying Git is installed using $ git --version
  3. Verifying the GOPATH using $ echo $GOPATH
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download