google / go-cmp

Package for comparing Go values in tests
BSD 3-Clause "New" or "Revised" License
4.08k stars 209 forks source link

Use of hotlinking of Go identifiers #337

Closed dsnet closed 10 months ago

dsnet commented 10 months ago

GoDoc now supports hot linking to specific Go identifiers. Use that feature to enhance the usability of cmp docs.

Since cmp lacks a direct dependency on cmpopts, you are forced to use the fully-qualified import path to references identifiers in the cmpopts package.

It can future improvements to the go/doc to handle this case, either by rendering the doc with short form, or by detecting the use of cmpopts from the unit tests as well (since those can break circular dependencies).

dsnet commented 10 months ago

See https://godoc.digital-static.net/github.com/google/go-cmp@v0.0.0/cmp to get a preview of what godoc looks like after this change.