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

x/pkgsite: searches for standard library packages should surface and prioritize v2 versions #68711

Open
cespare opened this issue Aug 2, 2024 · 3 comments
Labels
NeedsFix The path to resolution is known, but the work has not been done. pkgsite/search Issues related to pkg.go.dev search functionality pkgsite

Comments

@cespare
Copy link
Contributor

cespare commented Aug 2, 2024

What is the URL of the page with the issue?

https://pkg.go.dev/search?q=rand

What is your user agent?

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36

Screenshot

screen_20240801232855

What did you do?

I searched for "rand".

What did you see happen?

The top search results were the standard library's math/rand and crypto/rand packages. The math/rand/v2 package, which is what I mean by "rand" in most new code I write today, does not appear in the list of search results. The only indication of math/rand/v2 is some small, easy-to-miss text below the math/rand search result which says:

Related packages in the standard library: math/rand/v2

What did you expect to see?

I think that if I search for "rand", math/rand/v2 ought to be very highly ranked in the search results; ideally, it would appear above math/rand. v2 is what people ought to be using for new code and we should nudge people in that direction. In any case, it should certainly appear near the top of the list.

I think this is just a case where pkgsite isn't keeping up with the v2 evolution happening in the standard library. As we get more v2 packages, the issue will get worse.

This is essentially the standard library equivalent of an issue I filed for third-party modules a few years back: #36969.

There's also a related, thornier issue: if I search for "math/rand", it takes me directly to https://pkg.go.dev/math/rand -- perhaps that ought to go to a search result page now that includes math/rand and math/rand/v2.

@cespare cespare added the pkgsite label Aug 2, 2024
@gopherbot gopherbot added this to the Unreleased milestone Aug 2, 2024
@gabyhelp
Copy link

gabyhelp commented Aug 2, 2024

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

@cespare
Copy link
Contributor Author

cespare commented Aug 2, 2024

#66452 is the "related, thornier" issue I mentioned at the end.

@seankhliao seankhliao added the pkgsite/search Issues related to pkg.go.dev search functionality label Aug 4, 2024
@hyangah hyangah modified the milestones: Unreleased, pkgsite/search Aug 8, 2024
@hyangah hyangah added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 8, 2024
@hyangah
Copy link
Contributor

hyangah commented Aug 8, 2024

cc @jba

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done. pkgsite/search Issues related to pkg.go.dev search functionality pkgsite
Projects
None yet
Development

No branches or pull requests

5 participants