Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Man page for golang?

Tags:

go

manpage

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?

like image 863
user218867 Avatar asked Apr 28 '18 06:04

user218867


2 Answers

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.

like image 130
VonC Avatar answered Sep 27 '22 19:09

VonC


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.
like image 44
user218867 Avatar answered Sep 27 '22 19:09

user218867