Closed
Description
With the acceptance of #40357, there is now a standard way for module authors to deprecate a module major version: by adding a "Deprecated" comment to the go.mod
file.
// Deprecated: ARBITRARY TEXT HERE
module M
...
pkg.go.dev should display deprecation notices prominently. We could display a banner with the deprecation comment at the top of every page that is part of the module major version.
Details:
- The
modules
table should have a TEXT column nameddeprecation
containing the comment. - Only the latest minor version of a module needs a deprecation comment for all the versions of that major version to be considered deprecated. That means that when inserting a module, we may need to update
modules.deprecation
for multiple rows. Alternatively, we could store it only on the latest version and have the frontend retrieve it whenever any version is accessed. Since we already get the latest version in order to display the Latest badge, this may not add any extra time if we organize the code right. - Because the text of the comment is arbitrary, we can't definitively link to the replacement module, if any. But we can heuristically link any word that looks like a module path.
- We will probably want to use
golang.org/x/mod/module.ParseLax
to extract the comment from thego.mod
file.