offline document for go/golang

xpt picture xpt · Aug 15, 2015 · Viewed 10.6k times · Source

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 http://127.0.0.1:6060/pkg/ 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
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

Bryon picture Bryon · Jun 9, 2018

I am not sure the answer marked as correct is actually the correct answer - I could not access the golang documentation offline using that at least.

This works for me on a Mac. I have not tested it on Ubuntu.

If you have godoc installed, run the following command:

godoc -http=:6060

Then open a browser with the following URL: http://127.0.0.1:6060/pkg/

Or http://127.0.0.1:6060/ to see the first page of the golang web site.

All of the doco from the gloang web site will then be available to you.