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

Use of hotlinking of Go identifiers #337

Merged
merged 1 commit into from
Aug 31, 2023
Merged

Use of hotlinking of Go identifiers #337

merged 1 commit into from
Aug 31, 2023

Conversation

dsnet
Copy link
Collaborator

@dsnet dsnet commented Aug 26, 2023

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 dsnet requested a review from neild August 26, 2023 18:54
// (e.g., cmpopts.IgnoreUnexported) ignores that field or the Exporter option
// explicitly permits comparing the unexported field.
// If a struct contains unexported fields, Equal panics unless an [Ignore] option
// (e.g., [github.com/google/go-cmp/cmp/cmpopts.IgnoreUnexported]) ignores that field
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is extremely gross.

In my opinion, go/doc should also gather up related packages from the unit tests as well. That would be easiest and most concise way to fix reverse dependencies.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regardless, this is better than the status quo.

Alternatively, we can consider #136.

@dsnet
Copy link
Collaborator Author

dsnet commented Aug 27, 2023

See https://godoc.digital-static.net/github.com/google/[email protected]/cmp to get a preview of what godoc looks like after this change.

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 dsnet merged commit e250a55 into master Aug 31, 2023
@dsnet dsnet deleted the godoc branch August 31, 2023 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants