go
go copied to clipboard
cmd/go: go doc does not understand module versioning
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.