-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: api: add mechanism for correlating deprecations with Go versions e.g. <version_deprecated>.txt #38149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't think pkg.go.dev would need that file. It could just figure it out while it "ingests" a new go version, from that version's godoc plus the data from the previous version. |
This file seems like an index that can be mechanically derived, not something we should require committing and letting drift out of date. pkg.go.dev can handle the main Go repo just fine, and I wouldn't want to impose new restrictions on other module maintainers for things that we can determine automatically. |
staticcheck already flags usage of deprecated symbols |
Based on the discussion above, this sounds like a likely decline (better to do automatically instead of a separate file that must be kept up to date). |
No change in consensus. Declined. |
Given that there is a way for ingestion to happen, I am fine with the decline. Thank you for the discourse and analyses everyone. |
Forgot to close. |
Just coming here from #37650 in which a user was mistakenly using a long deprecated field net/http/httptest.Recorder.HeaderMap instead of net/http/httptest.Recorder.Result()

While we use the
// Deprecated:
notice as the de facto standard for deprecating fields, it might be very useful for one to know when a field was deprecated.I propose that just like we have
api/<version>.txt
whose entries are of the form:pkg <PKG_NAME>, <IDENTIFIER>
that we add another form also within that same directory
<api/version_deprecated>.txt
, whose line content formats will be the exact same as those forapi/<version>.txt
, so no change in parser, but an addition would be that GoDoc can then quickly look up what was deprecated and when and render that along.This way we can make for more powerful tooling like, for example pkg.go.dev could give a deprecation policy notice between versions and is even more advantageous:
Many Go deprecation notices are loosely followed because for the longest time we didn't have modules so years later, users would still using deprecated fields. This suggestion could help in issuing stale code notices and not just when they switch to a module and have to suddenly re-write their code. This can help with more powerful refactoring.
The text was updated successfully, but these errors were encountered: