Closed
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
go version go1.10beta2 linux/amd64
Does this issue reproduce with the latest release?
Yes, but Go 1.10 is supposed to change that, https://tip.golang.org/doc/go1.10#goroot
(Awesome change by the way!)
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/fd0/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/fd0/shared/work/go"
GORACE=""
GOROOT="/home/fd0/Downloads/go1.10beta2"
GOTMPDIR=""
GOTOOLDIR="/home/fd0/Downloads/go1.10beta2/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build797922256=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Without $GOROOT
explicitely set, Go 1.10 infers the Go root directory from the location of the go
binary as it called:
$ unset GOROOT
$ pwd
/home/fd0/Downloads/go1.10beta2
$ bin/go version
go version go1.10beta2 linux/amd64
$ bin/go env GOROOT
/home/fd0/Downloads/go1.10beta2
But this does not work for godoc
:
$ bin/godoc os Exit
2018/01/15 14:17:19 cannot find package "." in:
/src/os
$ bin/godoc -http :6060
2018/01/15 14:17:34 newDirectory(/): stat /usr/local/go: no such file or directory
2018/01/15 14:17:34 godoc: corpus fstree is nil
Explicitely setting GOROOT
(like in Go < 1.10) works:
$ GOROOT=$PWD bin/godoc os Exit
use 'godoc cmd/os' for documentation on the os command
func Exit(code int)
Exit causes the current program to exit with the given status code.
Conventionally, code zero indicates success, non-zero an error. The
program terminates immediately; deferred functions are not run.
What did you expect to see?
godoc
finds the Go root directory ($GOROOT
) by itself, like the go
binary does. This is advertised as one of the (awesome) changes of Go 1.10, apparently it does not work for godoc
yet, which is unexpected.
What did you see instead?
The Go root directory is not detected automatically, I needed to set it manually via $GOROOT
.