-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/cmd/godoc: all std packages are treated as command #14447
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
Comments
Not critical for Go 1.9. But also looks like a good HelpWanted project for somebody, self-contained in |
Weird, but I can not get
Looking at this comment (cmdline.go:72):
Let's check my guess: diff --git a/godoc/pres.go b/godoc/pres.go
index 8551177..5e62b08 100644
--- a/godoc/pres.go
+++ b/godoc/pres.go
@@ -119,7 +119,7 @@ func NewPresentation(c *Corpus) *Presentation {
p: p,
c: c,
pattern: "/cmd/",
- fsRoot: "/src",
+ fsRoot: "/src/cmd",
}
p.pkgHandler = handlerServer{
p: p, Tests are passing.
Now check the case that is described by @minux:
Seems like it works as intended. I do believe the real solution should look different, otherwise |
It seems like it matches $ ls -R
.:
src
./src:
foo
./src/foo:
foo.go
$ godoc -goroot=`pwd` foo | head -n 4
use 'godoc cmd/foo' for documentation on the foo command
PACKAGE DOCUMENTATION
$ godoc -goroot=`pwd` cmd/foo | head -n 4
PACKAGE DOCUMENTATION
package foo
import "." Note: patch provided above does make
|
Hi Iskander,
Yes, I see this too. It should definitely be a bug. More so, if
I can take this up if you are not actively working on this. |
Hello @agnivade.
I am not. Good luck. |
Looked into this. There is a complex path of lots of if-elses which decides on what is a cmd and what is a src package. I feel this will be best solved by someone with prior knowledge of godoc. |
Change https://golang.org/cl/94841 mentions this issue: |
Fix was reverted for breaking the build. Reopening. |
godoc is erroneously detecting paths like syscall and unsafe as possible commands. A previous attempt at a fix adjusted the parameters of pkgHandler in pres.go, but that change had unexpected ripple effects that broke links and other features of godoc. This change is scoped only to the godoc command line tool. cmdline_test.go is updated to match the parameters used in the real pkgHandler in pres.go. Fixes golang/go#14447
Change https://golang.org/cl/96515 mentions this issue: |
@agnivade, I have tested your last CL and it works as expected:
|
It's not my CL 😝 |
Fixes golang/go#14447 GitHub-Last-Rev: 98ea70ca4df4e1bdead0b3960ef0381b4f81572b GitHub-Pull-Request: golang/tools#24 Change-Id: Ida7db414a47ea6f6da5de400bcb6a5aea03f1d05 Reviewed-on: https://go-review.googlesource.com/94841 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
godoc is erroneously detecting paths like syscall and unsafe as possible commands. A previous attempt at a fix adjusted the parameters of pkgHandler in pres.go, but that change had unexpected ripple effects that broke links and other features of godoc. This change is scoped only to the godoc command line tool. cmdline_test.go is updated to match the parameters used in the real pkgHandler in pres.go. Fixes golang/go#14447 Change-Id: I8f740c6847e46523b8443722b16942192bdf9cb8 GitHub-Last-Rev: cfc24f2d4c3519c4c87628b2021f65a4725cda6b GitHub-Pull-Request: golang/tools#27 Reviewed-on: https://go-review.googlesource.com/96515 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
I thought there is something wrong with my environment, but I confirmed
this behavior with freshly installed Go tip and godoc tip on a new machine.
The text was updated successfully, but these errors were encountered: