go icon indicating copy to clipboard operation
go copied to clipboard

x/pkgsite: report whether a subpackage is a command

Open avamsi opened this issue 1 year ago • 4 comments

What is the URL of the page with the issue?

https://pkg.go.dev/golang.org/x/perf, for example.

Screenshot

image

What did you expect to see?

Subpackage that are commands are reported as such with a command chip (similar to search results / package page).

What did you see instead?

Only modules are reported with a module chip.


I'm working on https://github.com/avamsi/gobin and would love this information! :) I currently don't process the subpackages (well, other than those that are inlined in the search results) but would love to, and if I'm not wrong, the only way to do this today is to hit the package pages for all the subpackages.

avamsi avatar Aug 19 '24 09:08 avamsi

I think this falls under #36785 since it isn't intended for the page to be scraped.

seankhliao avatar Aug 19 '24 09:08 seankhliao

This will arguably help humans in disambiguating packages as well (consider golang.org/x/perf/benchstat vs golang.org/x/perf/cmd/benchstat from above, for example -- although I guess cmd/ is hint enough here).

FWIW, I was going through the code and this might be as simple as adding a new IsCommand field with pm.Name == "main" here (and using it here to render the command chip)?

avamsi avatar Aug 19 '24 16:08 avamsi

cc: @jba

ansaba avatar Aug 22 '24 15:08 ansaba

Change https://go.dev/cl/620739 mentions this issue: internal/frontend: report whether subdirectories are commands

gopherbot avatar Oct 18 '24 12:10 gopherbot