Skip to content

x/pkgsite: show interfaces/implementations #72904

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

Open
adonovan opened this issue Mar 17, 2025 · 5 comments
Open

x/pkgsite: show interfaces/implementations #72904

adonovan opened this issue Mar 17, 2025 · 5 comments
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. pkgsite

Comments

@adonovan
Copy link
Member

A Go user is confused as to how to find implementations of interfaces: https://bsky.app/profile/sszuecs.bsky.social/post/3lis5o4nv322u.

Google's internal package index relates each interface type to its concrete implementations (and vice versa), and each interface method to it corresponding method. This would be useful information to display in pkgsite too.

It requires a global index of methods, similar to what we build in gopls and Google's internal package index, but the ideas are familiar at this point.

@seankhliao seankhliao changed the title pkgsite: show interfaces/implementations x/pkgsite: show interfaces/implementations Mar 17, 2025
@gopherbot gopherbot added this to the Unreleased milestone Mar 17, 2025
@seankhliao
Copy link
Member

maybe a dupe of #20131 ?
though that was changed from godoc to pkgsite

@adonovan
Copy link
Member Author

maybe a dupe of #20131 ?

Thanks, yeah, it is essentially a dupe.

though that was changed from godoc to pkgsite

This feature has a long history. I implemented it in x/tools/cmd/godoc over a decade ago but it never made it to pkgsite. I suspect that it may be trickier to implement fully in pkgsite because (a) unlike godoc, pkgsite doesn't type-check anything and (b) pkgsite doesn't currently show any cross-package derived data, which would requirea global index.

@zigo101
Copy link

zigo101 commented Mar 18, 2025

Will this be implemented in the global space for all Go packages in the world?
If yes, then some popular interface types might have tens of thousands implementations
which will make some std package pages bloat.

Golds implements this in a project scope.

@adonovan
Copy link
Member Author

Will this be implemented in the global space for all Go packages in the world?

Ranking is clearly a part of the solution. I would expect to see implementations in the same package before those in dependencies in the same module, before non-dependency packages in the same module, before arbitrary dependencies in other modules, before arbitrary unrelated packages in the ecosystem. The last could be behind a "more..." button.

@jba
Copy link
Contributor

jba commented Mar 20, 2025

This is a large feature. Don't expect it anytime soon.
Also, it would have to be syntax-based, thus inaccurate.

@jba jba modified the milestones: Unreleased, Backlog, pkgsite/backlog Mar 20, 2025
@prattmic prattmic added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. pkgsite
Projects
None yet
Development

No branches or pull requests

6 participants