gvm icon indicating copy to clipboard operation
gvm copied to clipboard

Doesn't install godoc

Open leebrooks0 opened this issue 10 years ago • 13 comments

I am brand new to Go (installed it today...), and I see that GVM doesn't install other utilities such as godoc. How do I install them? If I have do an apt-get install golang-stable to get them, then how does GVM help?

leebrooks0 avatar Dec 29 '13 20:12 leebrooks0

Starting in Go 1.2, the go doc command has been deleted:

http://golang.org/doc/go1.2#go_doc

As the documentation says, the actual godoc tool is still available, but it means you'll have to install the go.tools repo:

http://godoc.org/code.google.com/p/go.tools/cmd/godoc

mdayaram avatar Jan 02 '14 19:01 mdayaram

Perhaps we should consider installing go.tools with GVM, or at least providing an option to do so.

mdayaram avatar Jan 02 '14 19:01 mdayaram

go get -u code.google.com/p/go.tools/cmd/godoc
godoc

This fails to install godoc fully, godoc exits with error:

2014/01/28 14:00:32 readTemplate: open $HOME/.gvm/gos/go1.2/lib/godoc/codewalk.html: no such file or directory

The godoc binary is in $GOROOT/bin/godoc

Those missing template files are in the mercurial metadata. Not sure if this is a godoc or gvm problem.

xsleonard avatar Jan 28 '14 19:01 xsleonard

Hmmm, odd, I can't replicate the error. What system are you running in?

mdayaram avatar Jan 28 '14 19:01 mdayaram

64bit linux, go1.2

I imploded gvm and reinstalled, same issue

xsleonard avatar Jan 28 '14 19:01 xsleonard

Hmm, it appears this might be a Go issue:

https://code.google.com/p/go/issues/detail?id=6010

However, I'm not sure why it would work fine for me and not you =/

Can you output your environment? Simply run go env

mdayaram avatar Jan 29 '14 07:01 mdayaram

Figured it out. Earlier unpurged installations of go under the /usr tree were somehow interfering, despite which godoc claiming /home/steve/.gvm/gos/go1.2/bin/godoc. Its either a Go issue or my shell acting up.

go env

GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/steve/.gvm/pkgsets/go1.2/global"
GORACE=""
GOROOT="/home/steve/.gvm/gos/go1.2"
GOTOOLDIR="/home/steve/.gvm/gos/go1.2/pkg/tool/linux_amd64"
TERM="dumb"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CXX="g++"
CGO_ENABLED="1"

xsleonard avatar Jan 29 '14 13:01 xsleonard

Ah, good to know. Can we consider this issue resolved then?

mdayaram avatar Jan 29 '14 18:01 mdayaram

Sorry, I hijacked the original issue, regarding having go.tools installed by default, or optionally. Up to you

xsleonard avatar Jan 29 '14 18:01 xsleonard

Ah right, let's leave it open.

mdayaram avatar Jan 31 '14 09:01 mdayaram

Makes sense to install godoc once under the system version, since it's a database, not a versioned package and is therefore immune to the need to be managed as a build dependency. Installing under system $GOPATH makes godoc command universally available for reference during local development, regardless of the active gvm-managed go version.
Above could be default behavior when running gvm-installer script, with a command flag option added to install without godoc.
Also for reference for future googlers, current install path is

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

ref New import paths for Go sub-respositories

remy-actual avatar Feb 20 '15 06:02 remy-actual

I will likely close this issue in the near future unless I hear otherwise.

BenKnigge avatar Feb 03 '20 04:02 BenKnigge

I met the same issue. Since I use Go1.18 under GVM to write generics codes, my system go binary is go1.13.15. The Godoc is for system go binary and cannot support new generics functions. I didn't find a way to use godoc under GVM specific version.

rainydew avatar Oct 18 '22 07:10 rainydew