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

cmd/go: doc fails on case-insensitive search for identifier similar to keyword #34656

Closed
DeedleFake opened this issue Oct 2, 2019 · 8 comments
Closed

Comments

@DeedleFake
Copy link

@DeedleFake DeedleFake commented Oct 2, 2019

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

$ go version
go version go1.13.1 linux/amd64

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="$HOME/.cache/go-build"
GOENV="$HOME/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="$HOME/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="$HOME/.go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="$HOME/.go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
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-build199061115=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$ go doc importer.default

What did you expect to see?

package importer // import "go/importer"

func Default() types.Importer
    Default returns an Importer for the compiler that built the running binary.
    If available, the result implements types.ImporterFrom.

What did you see instead?

doc: invalid identifier "default"
exit status 1
@andybons
Copy link
Member

@andybons andybons commented Oct 2, 2019

@andybons andybons added this to the Unplanned milestone Oct 2, 2019
@robpike
Copy link
Contributor

@robpike robpike commented Oct 3, 2019

This seems more annoying to fix than it's worth, since typing the actual name will work.

@DeedleFake
Copy link
Author

@DeedleFake DeedleFake commented Oct 3, 2019

Makes sense. Maybe instead a line could be inserted in the help to document the behavior.

Alternatively, would you accept a pull request to fix it? I might look into sending one if I have time at some point.

@mvdan
Copy link
Member

@mvdan mvdan commented Oct 3, 2019

@DeedleFake I think investigating if a simple fix exists would be useful. But if the fix adds a non-trivial amount of complexity, then I'd agree with Rob that it's probably not worth merging.

A CL would be useful either way though, for future reference.

@gopherbot
Copy link

@gopherbot gopherbot commented Nov 4, 2019

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Nov 4, 2019
@cespare
Copy link
Contributor

@cespare cespare commented Nov 7, 2019

This bites me semi-regularly. I never type capital letters into my go doc query (why bother?) and so I get annoying failures every time the thing I'm looking for happens to be a keyword.

$ go doc sort.interface
doc: invalid identifier "interface"
exit status 1
$ go doc types.type
doc: invalid identifier "type"
exit status 1
@gopherbot
Copy link

@gopherbot gopherbot commented Nov 7, 2019

Change https://golang.org/cl/205778 mentions this issue: cmd/doc: don't bother checking validity of symbols at top level

@agnivade
Copy link
Contributor

@agnivade agnivade commented Nov 7, 2019

Reopening for the CL to close it.

@agnivade agnivade reopened this Nov 7, 2019
@gopherbot gopherbot closed this Nov 7, 2019
@agnivade agnivade removed the WaitingForInfo label Nov 7, 2019
@mvdan mvdan reopened this Nov 7, 2019
@gopherbot gopherbot closed this in 7a2baa9 Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants
You can’t perform that action at this time.