gvm
gvm copied to clipboard
Doesn't install godoc
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?
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
Perhaps we should consider installing go.tools with GVM, or at least providing an option to do so.
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.
Hmmm, odd, I can't replicate the error. What system are you running in?
64bit linux, go1.2
I imploded gvm and reinstalled, same issue
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
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"
Ah, good to know. Can we consider this issue resolved then?
Sorry, I hijacked the original issue, regarding having go.tools installed by default, or optionally. Up to you
Ah right, let's leave it open.
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
I will likely close this issue in the near future unless I hear otherwise.
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.