golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
122.88k stars 17.52k forks source link

x/pkgsite: Support symbol search within module #47843

Open prattmic opened 3 years ago

prattmic commented 3 years ago

What is the URL of the page with the issue?

https://beta.pkg.go.dev/gvisor.dev/gvisor

https://beta.pkg.go.dev/search?m=symbol&q=CompareAndSwapUint32

What is your user agent?

Mozilla/5.0 (X11; CrOS x86_64 13982.69.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.130 Safari/537.36

Screenshot

N/A

What did you do?

I would like to a way to do symbol search within a single module, exposed in the UI.

As a concrete example, I know that the gvisor.dev/gvisor module has a function named CompareAndSwapUint32, but I may not remember where it is. This is a common name, so a global search is not useful.

(Bonus points if I could make a saved search to search multiple modules. Something like "baz (module:example.com/foo OR module:example.com/bar)").

What did you expect to see?

Some way to limit the search to the current module would be very helpful. Perhaps the search dropdown could have "Symbols" and "Symbols (this module only)".

Current package search is often desired too. This already exists via Ctrl+F, but if module search is added then package search should perhaps be surfaced in the same place in the UI as well.

What did you see instead?

Nothing.

julieqiu commented 3 years ago

Does https://beta.pkg.go.dev/search?m=symbol&q=CompareAndSwapUint32+gvisor.dev%2Fgvisor address this issue? (You can type any full module path or sub-path along with the symbol)

prattmic commented 3 years ago

Ah, nice! This does what I want, though I think it would be nice to surface "search within module" somewhere in the UI, since it is not obvious.

julieqiu commented 3 years ago

That is good feedback, thanks!

/cc @jinhongy @fflewddur