Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
x/pkgsite: Organization of package-level constants #40970
What did you do?
What did you expect to see?
Below the Index (and Package Files) I expected to see all of the constants available in the package.
What did you see instead?
Instead, the constants are grouped under their types:
This is not always the case, for example in Logrus:
The difference may be that, because those package-level constants are strings, they have no type to be grouped under and so float to the top. Also, there are some package-level variables that are still at the top—so maybe those are treated differently, or maybe it's because it's a slice of that custom type and the logic doesn't take slices into account.
I could slice the points more finely and articulate them in various ways, but I believe that the original style of overview was better. You could see all types and methods in the Index, (including constructors) and then below that all of the package-level variables—voila, you have seen the package's public API. If you have questions about the type of these constants, you can click them to drill down to the details. Colocating the constants with their types seems to "ease" this click step by sacrificing the overview.
Perhaps, as an alternative, if a type has constants, it can have a link to the Constants section up top?
This is my impression as a user, but I'm curious what other community members think.
Hm, now I'm a little confused.
Here's the PayPal REST API in Godoc: https://godoc.org/github.com/plutov/paypal
Most of the constants are up top, but UserAction has its constants grouped under the type. The pkg.go.dev version is definitely different, with more constants grouped under their types, but clearly it's not black-and-white and I can't tell why.