Skip to content

Commit c4dd16a

Browse files
committed
golangci-lint: warn about deprecated APIs only as hints
This particualar warning didn't make it into kubernetes#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".
1 parent 04292dd commit c4dd16a

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

hack/golangci-strict.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ issues:
8383
- gosimple
8484
text: "S1033: unnecessary guard around call to delete"
8585

86+
# Didn't make it into https://github.com/kubernetes/kubernetes/issues/117288.
87+
# Discussion on Slack concluded that "it's hard to have a universal policy for all
88+
# functions marked deprecated" and thus this can only be a hint which must
89+
# be considered on a case-by-case basis.
90+
- linters:
91+
- staticcheck
92+
text: "SA1019: .*is deprecated"
93+
8694
# https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1507030071
8795
- linters:
8896
- stylecheck

hack/golangci.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ issues:
8989
- gosimple
9090
text: "S1033: unnecessary guard around call to delete"
9191

92+
# Didn't make it into https://github.com/kubernetes/kubernetes/issues/117288.
93+
# Discussion on Slack concluded that "it's hard to have a universal policy for all
94+
# functions marked deprecated" and thus this can only be a hint which must
95+
# be considered on a case-by-case basis.
96+
- linters:
97+
- staticcheck
98+
text: "SA1019: .*is deprecated"
99+
92100
# https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1507030071
93101
- linters:
94102
- stylecheck

hack/golangci.yaml.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ issues:
9494
- gosimple
9595
text: "S1033: unnecessary guard around call to delete"
9696

97+
# Didn't make it into https://github.com/kubernetes/kubernetes/issues/117288.
98+
# Discussion on Slack concluded that "it's hard to have a universal policy for all
99+
# functions marked deprecated" and thus this can only be a hint which must
100+
# be considered on a case-by-case basis.
101+
- linters:
102+
- staticcheck
103+
text: "SA1019: .*is deprecated"
104+
97105
# https://github.com/kubernetes/kubernetes/issues/117288#issuecomment-1507030071
98106
- linters:
99107
- stylecheck

0 commit comments

Comments
 (0)