x/pkgsite: "added in version" does not account for new packages #51013
Labels
FeatureRequest
Issues asking for a new feature that does not need a proposal.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
pkgsite
Milestone
The "added in vX" notes on the rendered API pages are super useful, and they work for both the Go project itself, as well as any module with releases, e.g:
added in go1.15
added in v0.14.0
However, there's no such "added in" information when a package started existing at a specific version. Two examples:
I think that information should be surfaced, because otherwise a user could easily fall into the trap that is assuming that, for example, https://pkg.go.dev/github.com/ipld/go-ipld-prime/node/bindnode#Prototype is safe to use on any version - since it has no "added in" information attached.
One solution would be to add "added in" information to the top of the package view, to inform at what version the package was added. This could be something as simple as "the first stable release the package was seen in this module", becauses I imagine and hope that adding a package, removing it, and adding it again should be extremely rare. I also imagine that the logic should be consistent with whatever algorithm the current API-based "added in" notes are computed with.
Another solution could be to add "added in" to all the APIs that were added with the package in the first place. This will be more visually consistent with what we've got now, and perhaps less prone to footguns, as a link to https://pkg.go.dev/github.com/ipld/go-ipld-prime/node/bindnode#Prototype will quickly give me that important information without me having to scroll all the way up and notice it.
I think the best solution is to do both; adding the information to each API is consistent and very clear, and adding it at the top is also relevant, because a package could have 0 exported API or have its own effect even if we don't use any of its API, via
init
functions.cc @golang/pkgsite
The text was updated successfully, but these errors were encountered: