You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FROM ubuntu
ADD https://dl.google.com/go/go1.10.1.linux-amd64.tar.gz /tmp
RUN tar -C /usr/local --strip-components=1 -xzf /tmp/go1.10.1.linux-amd64.tar.gz
RUN mkdir -p /go/src/foo
RUN printf 'package main\nimport "fmt"\nfunc main() {fmt.Println("Hello, godoc")}' >/go/src/foo/main.go
ENV GOPATH /go
Please note that this is installing Go directly under /usr/local and not /usr/local/go as the recommended installation instructions do. I haven't found any issue with this so far other than this problem with godoc.
Build the image with docker build . and then fire it up with docker run -it <the-image-you-built> bash
Once in the container:
root@1015578e9135:/# godoc -http=:8055 -analysis=type
2018/04/23 08:29:32 newDirectory(/): stat /usr/local/go: no such file or directory
2018/04/23 08:29:32 godoc: corpus fstree is nil
root@1015578e9135:/# godoc -goroot=/usr/local -http=:8055 -analysis=type
2018/04/23 08:29:36 GOROOT=/usr/local/go/src/: []
2018/04/23 08:29:36 GOPATH[0]=/go/src/: [foo]
2018/04/23 08:29:36 Loading and type-checking packages...
/go/src/foo/main.go:2:8: could not import fmt (cannot find package "fmt" in any of:
/usr/local/go/src/fmt (from $GOROOT)
/go/src/fmt (from $GOPATH))
2018/04/23 08:29:36 Loaded 1 packages.
2018/04/23 08:29:36 Constructing SSA form...
2018/04/23 08:29:36 SSA construction complete
2018/04/23 08:29:36 Computing implements relation...
2018/04/23 08:29:36 Extracting type info...
2018/04/23 08:29:36 Visit instructions...
2018/04/23 08:29:36 Visit instructions complete
2018/04/23 08:29:36 Type analysis complete.
The only thing that works is setting the GOROOT environment variable:
godoc should be able to load the standard library by honoring the default implicit value of GOROOT as printed by go env. Or at least setting the -goroot flag should work.
What did you see instead?
godoc fails to load standard library packages unless GOROOT is set.
The text was updated successfully, but these errors were encountered:
Awww, of course it's right after filing the issue that I find it's a dup. This is already filed under #23445. I swear I looked for godoc issues first, but not hard enough apparently! Sorry for the noise.
What version of Go are you using (
go version
)?go version go1.10.1 linux/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
Use the following
Dockerfile
:Please note that this is installing Go directly under
/usr/local
and not/usr/local/go
as the recommended installation instructions do. I haven't found any issue with this so far other than this problem withgodoc
.Build the image with
docker build .
and then fire it up withdocker run -it <the-image-you-built> bash
Once in the container:
The only thing that works is setting the
GOROOT
environment variable:What did you expect to see?
godoc
should be able to load the standard library by honoring the default implicit value ofGOROOT
as printed bygo env
. Or at least setting the-goroot
flag should work.What did you see instead?
godoc
fails to load standard library packages unlessGOROOT
is set.The text was updated successfully, but these errors were encountered: