go icon indicating copy to clipboard operation
go copied to clipboard

cmd/go: go doc does not understand module versioning

Open crawshaw opened this issue 3 years ago • 0 comments

With:

go mod init junk
go get golang.org/x/crypto/blake2s
go get github.com/fxamacker/cbor/v2

I can run go doc blake2s and get package documentation. However I cannot similarly get docs for cbor:

go doc cbor
doc: no buildable Go source files in /tmp/junk
exit status 1

Even if I add a use of the package:

package main

import "github.com/fxamacker/cbor/v2"

type t cbor.Tag

func main() {
}

then go doc still cannot find it:

go doc cbor
doc: no symbol cbor in package /tmp/junk
exit status 1

Explicitly adding the version as go doc cbor/v2 works, but that involves always remembering the version.

crawshaw avatar Aug 08 '22 19:08 crawshaw