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 golang-doc but it is actually not — there aren’t any Go package docs in it.

Then I research further and tried

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 vivid/main amd64


According to Installing Go from source:

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

$ go install

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

$ go install

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 install
  2. Verifying Git is installed using $ git --version
  3. Verifying the GOPATH using $ echo $GOPATH

Answered By – Matthew Rankin

Answer Checked By – Candace Johnson (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.