golangci-lint: warn about deprecated APIs only as hints

This particualar warning didn't make it into
https://github.com/kubernetes/kubernetes/issues/117288.  Discussion on Slack
concluded that "it's hard to have a universal policy for all functions marked
deprecated" and thus this can only be a hint which must be considered on a
case-by-case basis.

For example, APIs like sets.String are very unlikely to ever go away, therefore
it is entirely up to developers whether they switch to sets.Set even though
sets.String is marked as deprecated.

Ideally, the deprecation message should explain this. It doesn't for sets ("use
generic Set instead"), so a better message in that case would have been
"consider using generic Set instead".
This commit is contained in:
Patrick Ohly 2023-09-06 13:30:51 +02:00
parent 04292dd94b
commit c4dd16a1f8
3 changed files with 24 additions and 0 deletions

View File

@ -83,6 +83,14 @@ issues:
- gosimple
text: "S1033: unnecessary guard around call to delete"
# Didn't make it into https://github.com/kubernetes/kubernetes/issues/117288.
# Discussion on Slack concluded that "it's hard to have a universal policy for all
# functions marked deprecated" and thus this can only be a hint which must
# be considered on a case-by-case basis.
- linters:
- staticcheck
text: "SA1019: .*is deprecated"
# https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1507030071
- linters:
- stylecheck

View File

@ -89,6 +89,14 @@ issues:
- gosimple
text: "S1033: unnecessary guard around call to delete"
# Didn't make it into https://github.com/kubernetes/kubernetes/issues/117288.
# Discussion on Slack concluded that "it's hard to have a universal policy for all
# functions marked deprecated" and thus this can only be a hint which must
# be considered on a case-by-case basis.
- linters:
- staticcheck
text: "SA1019: .*is deprecated"
# https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1507030071
- linters:
- stylecheck

View File

@ -94,6 +94,14 @@ issues:
- gosimple
text: "S1033: unnecessary guard around call to delete"
# Didn't make it into https://github.com/kubernetes/kubernetes/issues/117288.
# Discussion on Slack concluded that "it's hard to have a universal policy for all
# functions marked deprecated" and thus this can only be a hint which must
# be considered on a case-by-case basis.
- linters:
- staticcheck
text: "SA1019: .*is deprecated"
# https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1507030071
- linters:
- stylecheck