Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/cmd/godoc: not populating Standard Library section #27162

Closed
jwendel opened this issue Aug 22, 2018 · 7 comments
Closed

x/tools/cmd/godoc: not populating Standard Library section #27162

jwendel opened this issue Aug 22, 2018 · 7 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@jwendel
Copy link

jwendel commented Aug 22, 2018

What version of Go are you using (go version)?

go version go1.11rc1 linux/amd64

Does this issue reproduce with the latest release?

Have not tried on tip

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jmwendel/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jmwendel/go"
GOPROXY=""
GORACE=""
GOROOT="/home/jmwendel/bin/go"
GOTMPDIR=""
GOTOOLDIR="/home/jmwendel/bin/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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-build346682857=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Ran this command:
$ godoc -http=":6060"
When I visit http://localhost:6060/pkg/, the "Standard Library" section is empty.
I completely cleared out my $GOPATH to be sure nothing in there got in the way.

output from godoc -v when loaded:

$ godoc -http=":6060" -v
2018/08/22 22:57:01 Go Documentation Server
2018/08/22 22:57:01 version = go1.11rc1
2018/08/22 22:57:01 address = :6060
2018/08/22 22:57:01 goroot = /home/jmwendel/bin/go
2018/08/22 22:57:01 tabwidth = 4
2018/08/22 22:57:01 search index disabled
name space {
/:
gated(os(/home/jmwendel/bin/go), 20) /
/lib/godoc:
mapfs /
/src:
gated(os(/home/jmwendel/bin/go), 20) /src
gated(os(/home/jmwendel/go), 20) /src
}
2018/08/22 22:57:01 starting HTTP server
2018/08/22 22:57:01 Error parsing /test/fixedbugs/bug050.go: /test/fixedbugs/bug050.go:7:1: expected 'package', found 'func'
2018/08/22 22:57:01 Error parsing /test/fixedbugs/bug088.go: /test/fixedbugs/bug088.go:7:1: expected 'package', found ignored
2018/08/22 22:57:01 Error parsing /test/fixedbugs/bug106.go: /test/fixedbugs/bug106.go:7:1: expected 'package', found ignored
2018/08/22 22:57:01 Error parsing /test/fixedbugs/bug222.go: /test/fixedbugs/bug222.go:7:1: expected 'package', found ignored
2018/08/22 22:57:01 Error parsing /test/fixedbugs/bug282.go: /test/fixedbugs/bug282.go:7:1: expected 'package', found ignored
2018/08/22 22:57:01 Error parsing /test/fixedbugs/bug306.go: /test/fixedbugs/bug306.go:7:1: expected 'package', found ignored
2018/08/22 22:57:01 Error parsing /test/fixedbugs/issue13266.go: /test/fixedbugs/issue13266.go:10:8: expected 'IDENT', found '%'
2018/08/22 22:57:01 Error parsing /test/fixedbugs/issue14164.go: /test/fixedbugs/issue14164.go:7:1: expected 'package', found ignored
2018/08/22 22:57:01 Error parsing /test/fixedbugs/issue24801.go: /test/fixedbugs/issue24801.go:5:51: expected 'package', found 'EOF'
2018/08/22 22:57:01 Error parsing /test/fixedbugs/issue4776.go: /test/fixedbugs/issue4776.go:9:1: expected 'package', found 'type'

What did you expect to see?

I'd expect to see all of the standard library docs listed there. When testing with godoc 1.10.3, the standard library docs are shown.

What did you see instead?

None of the standard library docs.

@meirf
Copy link
Contributor

meirf commented Aug 23, 2018

@jwendel can you confirm that the only difference between when you see the std lib docs and when you don't is the version of go (go1.10.3 see, go1.11rc1 don't see)?

/cc @agnivade @ysmolsky

@meirf meirf changed the title godoc not populating Standard Library section x/tools/cmd/godoc: not populating Standard Library section Aug 23, 2018
@gopherbot gopherbot added this to the Unreleased milestone Aug 23, 2018
@agnivade
Copy link
Contributor

Got it. This only happens when the resolved GOROOT is not equal to the runtime.GOROOT(). The goroot finding logic was upgraded from just runtime.GOROOT() to be able to dynamically find the GOROOT depending on the binary.

But unfortunately, my code which splits the package listing to standard library and others still use runtime.GOROOT to determine where the package root is. Will send a fix. It did not get caught so long because I was always running the binary locally.

@agnivade agnivade self-assigned this Aug 23, 2018
@agnivade agnivade added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Aug 23, 2018
@agnivade agnivade modified the milestones: Unreleased, Go1.11 Aug 23, 2018
@agnivade
Copy link
Contributor

Tentatively marked as release blocker.

@bradfitz @andybons

Sending the fix soon.

@gopherbot
Copy link

Change https://golang.org/cl/130796 mentions this issue: godoc: update to use new goroot finding logic

@gopherbot
Copy link

Change https://golang.org/cl/131035 mentions this issue: [release-branch.go1.11] godoc: update to use new goroot finding logic

gopherbot pushed a commit to golang/tools that referenced this issue Aug 23, 2018
The logic to determine whether a filesystem root was in GOROOT or GOPATH
still relied on runtime.GOROOT(), whereas cmd/godoc was updated to copy
the goroot finding logic from standard library.

Hence, godoc is unable to determine if a filesystem is in GOROOT or not
when the binary is outside runtime.GOROOT(). So we expose a new variable
and set that from cmd/godoc to avoid copying the logic again for the 3rd time.

Fixes golang/go#27162

Change-Id: I160dcdbdd262e671f09f7bf01c329be5eac280ad
Reviewed-on: https://go-review.googlesource.com/130796
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit b43ba4d)
Reviewed-on: https://go-review.googlesource.com/131035
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
@andybons
Copy link
Member

This does not appear to be fixed: https://godoc-test.golang.org/pkg/

@andybons
Copy link
Member

Never mind. Our GAE instance is not running the version we want :/

@golang golang locked and limited conversation to collaborators Aug 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

5 participants