Skip to content

Commit 23ab774

Browse files
committed
fix: upgrade to godoclint v0.9.0
This version introduces a new rule, named `deprecated`, which checks the formatting of deprecation notes in godocs. Signed-off-by: Babak K. Shandiz <[email protected]>
1 parent cad6711 commit 23ab774

File tree

8 files changed

+46
-4
lines changed

8 files changed

+46
-4
lines changed

.golangci.next.reference.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,9 @@ linters:
12921292
# Require godoc for all public symbols.
12931293
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#require-doc
12941294
- require-doc
1295+
# Assert correct formatting of deprecation notes.
1296+
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#deprecated
1297+
- deprecated
12951298
# Assert maximum line length for godocs.
12961299
# https://github.com/godoc-lint/godoc-lint?tab=readme-ov-file#max-len
12971300
- max-len
@@ -1307,6 +1310,7 @@ linters:
13071310
- require-pkg-doc
13081311
- start-with-name
13091312
- require-doc
1313+
- deprecated
13101314
- max-len
13111315
- no-unused-link
13121316

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ require (
4545
github.com/go-critic/go-critic v0.13.0
4646
github.com/go-viper/mapstructure/v2 v2.4.0
4747
github.com/go-xmlfmt/xmlfmt v1.1.3
48-
github.com/godoc-lint/godoc-lint v0.8.0
48+
github.com/godoc-lint/godoc-lint v0.9.0
4949
github.com/gofrs/flock v0.12.1
5050
github.com/golangci/asciicheck v0.5.0
5151
github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32

go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsonschema/golangci.next.jsonschema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@
484484
"require-pkg-doc",
485485
"start-with-name",
486486
"require-doc",
487+
"deprecated",
487488
"max-len",
488489
"no-unused-link"
489490
]

pkg/golinters/godoclint/testdata/godoclint.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ linters:
99
- require-pkg-doc
1010
- start-with-name
1111
- require-doc
12-
- no-unused-link
12+
- deprecated
1313
- max-len
14+
- no-unused-link
1415
options:
1516
start-with-name:
1617
include-unexported: true

pkg/golinters/godoclint/testdata/godoclint_full_fail.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,18 @@ const constWithUnusedLink = 1
9090

9191
// constWithTooLongGodoc has a very long godoc that exceeds the maximum allowed length for godoc comments in this test setup. // want `godoc line is too long \(169 > 127\)`
9292
const constWithTooLongGodoc = 1
93+
94+
// DeprecatedConstA is... // want `deprecation note should be formatted as "Deprecated: "`
95+
//
96+
// DEPRECATED: do not use
97+
const DeprecatedConstA = 1
98+
99+
// DeprecatedConstB is... // want `deprecation note should be formatted as "Deprecated: "`
100+
//
101+
// DEPRECATED:do not use
102+
const DeprecatedConstB = 1
103+
104+
// DeprecatedConstC is... // want `deprecation note should be formatted as "Deprecated: "`
105+
//
106+
// deprecated:do not use
107+
const DeprecatedConstC = 1

pkg/golinters/godoclint/testdata/godoclint_full_pass.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,16 @@ const constWithUnusedLink = 1
6060

6161
// constWithTooLongGodoc has a very long godoc that does not exceed the maximum allowed length for godoc comments.
6262
const constWithTooLongGodoc = 1
63+
64+
// DeprecatedConstA is...
65+
//
66+
// Deprecated: do not use
67+
const DeprecatedConstA = 1
68+
69+
// Deprecated: do not use
70+
const DeprecatedConstB = 1
71+
72+
// deprecatedConstC is...
73+
//
74+
// DEPRECATED: invalid deprecation note but okay since the symbol is not exported
75+
const deprecatedConstC = 1

pkg/golinters/godoclint/testdata/godoclint_full_pass_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,11 @@ const constWithUnusedLink = 1
6060

6161
// constWithTooLongGodoc has a very long godoc that does not exceed the maximum allowed length for godoc comments.
6262
const constWithTooLongGodoc = 1
63+
64+
// DeprecatedConstA is...
65+
//
66+
// Deprecated: do not use
67+
const DeprecatedConstA = 1
68+
69+
// Deprecated: do not use
70+
const DeprecatedConstB = 1

0 commit comments

Comments
 (0)