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: all std packages are treated as command #14447
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 😝 |
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: