Eric
Eric

Reputation: 24920

Man page for golang?

Though go help is useful, but still it's not as expressive as man pages.

So, any way to get man page for go binaries on unix based systems?

If not, why such a feature hasn't been done since golang is so popular nowadays?

Upvotes: 6

Views: 4070

Answers (2)

Eric
Eric

Reputation: 24920

For Ubuntu, I found this solution: https://github.com/golang/go/wiki/Ubuntu


Example - ubuntu 16.04 & golang 1.10 (2018-04)

sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt-get update
sudo apt-get install golang-go

Then man pages are available.

e.g

man go
man go-get    # man page for `go get` sub command,
man gofmt

Tips:

  • Newest version of golang might can't be installed via the method above (it has some kind of delay I think).
    My solution is to install the newest/desired version of golang via download manually, and make sure in $PATH, the manually installed one is searched first.
    So that when use which go, it will found the manually installed binary, instead of the one installed via apt-get.
    Thus could get the man page, while still able to use any desired version of golang.

Upvotes: 2

VonC
VonC

Reputation: 1324935

You have an alternative with goman, presented here

See the GitHub project christophberger/goman: that is not for Go itself, but could be adapted to generate the man page for Go.

Otherwise... go issue 101 is one of the oldest issues out there (2009), and still opened!
It was supposed to be fixed by an official goman command (see CL 5700081), but that never was completed.

Upvotes: 8

Related Questions