Skip to content

Commit e9db998

Browse files
committed
Update golangci-lint and zerolint version
Signed-off-by: Oliver Eikemeier <[email protected]>
1 parent 4426f51 commit e9db998

File tree

8 files changed

+49
-47
lines changed

8 files changed

+49
-47
lines changed

.custom-gcl.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
version: v2.1.1
2+
version: v2.1.6
33
plugins:
44
- module: fillmore-labs.com/zerolint-golangci-plugin
55
path: .

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-24.04
1919
strategy:
2020
matrix:
21-
go-version: ["1.24.2", "1.23.8"]
21+
go-version: ["1.24.3", "1.23.9"]
2222
env:
2323
GOTOOLCHAIN: local
2424
steps:
@@ -29,9 +29,9 @@ jobs:
2929
with:
3030
go-version: ${{ matrix.go-version }}
3131
- name: 🧸 golangci-lint
32-
uses: golangci/golangci-lint-action@v7
32+
uses: golangci/golangci-lint-action@v8
3333
with:
34-
version: v2.1.1
34+
version: v2.1.6
3535
args: --config=.golangci-default.yaml
3636
- name: 🔨 Test
3737
run: golangci-lint custom -v && ./custom-gcl run -v .

.golangci-default.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ run:
77
formatters:
88
enable:
99
- gofumpt
10-
settings:
11-
gofumpt:
12-
module-path: fillmore-labs.com/zerolint
1310

1411
linters:
1512
default: all
@@ -21,7 +18,6 @@ linters:
2118
- nonamedreturns
2219
- varnamelen
2320
- wrapcheck
24-
- wsl
2521
settings:
2622
errcheck:
2723
exclude-functions:

.golangci.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
version: "2"
33

44
run:
5-
go: 1.23.8
5+
go: 1.23.9
66
modules-download-mode: readonly
77

88
linters:
@@ -12,6 +12,11 @@ linters:
1212
custom:
1313
zerolint:
1414
type: module
15+
description: "zerolint checks usage patterns of pointers to zero-size types."
16+
original-url: "https://fillmore-labs.com/zerolint"
1517
settings:
16-
full: false
17-
excluded: []
18+
level: "full"
19+
excluded:
20+
- "struct{}"
21+
generated: true
22+
match: "^.*$"

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,32 @@ Add a file `.custom-gcl.yaml` to your source with
1010

1111
```YAML
1212
---
13-
version: v2.1.1
13+
version: v2.1.6
1414
plugins:
1515
- module: fillmore-labs.com/zerolint-golangci-plugin
16-
version: v0.0.8
16+
version: v0.0.9
1717
```
1818
1919
then run `golangci-lint custom`. You get an `custom-gcl` executable that can be configured in `.golangci.yaml`:
2020

2121
```YAML
2222
---
23+
version: "2"
2324
linters:
2425
enable:
2526
- zerolint
2627
settings:
2728
custom:
2829
zerolint:
2930
type: module
31+
description: "zerolint checks usage patterns of pointers to zero-size types."
32+
original-url: "https://fillmore-labs.com/zerolint"
3033
settings:
31-
full: false
32-
excluded: []
34+
level: "full"
35+
excluded:
36+
- "struct{}"
37+
generated: true
38+
match: "^your\\.domain/package/path"
3339
```
3440

3541
and can be used like `golangci-lint`:

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ module fillmore-labs.com/zerolint-golangci-plugin
22

33
go 1.23.0
44

5-
toolchain go1.24.2
5+
toolchain go1.24.3
66

77
require (
8-
fillmore-labs.com/zerolint v0.0.8
9-
github.com/golangci/plugin-module-register v0.1.1
10-
golang.org/x/tools v0.32.0
8+
fillmore-labs.com/zerolint v0.0.9
9+
github.com/golangci/plugin-module-register v0.1.2
10+
golang.org/x/tools v0.33.0
1111
)

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
fillmore-labs.com/zerolint v0.0.8 h1:AqtUcOqRBXExBk0RoOmgVS7c/s17ICfvhYLG1ZUXWdI=
2-
fillmore-labs.com/zerolint v0.0.8/go.mod h1:4ZBySqMSeBOwT4Q3nUl0NUS2/RvhDNTvgIhybmABdRA=
3-
github.com/golangci/plugin-module-register v0.1.1 h1:TCmesur25LnyJkpsVrupv1Cdzo+2f7zX0H6Jkw1Ol6c=
4-
github.com/golangci/plugin-module-register v0.1.1/go.mod h1:TTpqoB6KkwOJMV8u7+NyXMrkwwESJLOkfl9TxR1DGFc=
1+
fillmore-labs.com/zerolint v0.0.9 h1:sh6jTmGHWEsMxQYSfsOmF9zyOZoQNXOPE5wP3W1MF1s=
2+
fillmore-labs.com/zerolint v0.0.9/go.mod h1:0V0kIS+x40wjQjQJGcAK0V9/H1T6rAvoy5oQo9Ue+5A=
3+
github.com/golangci/plugin-module-register v0.1.2 h1:e5WM6PO6NIAEcij3B053CohVp3HIYbzSuP53UAYgOpg=
4+
github.com/golangci/plugin-module-register v0.1.2/go.mod h1:1+QGTsKBvAIvPvoY/os+G5eoqxWn70HYDm2uvUyGuVw=
55
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
66
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
7-
golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610=
8-
golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
9-
golang.org/x/tools v0.32.0 h1:Q7N1vhpkQv7ybVzLFtTjvQya2ewbwNDZzUgfXGqtMWU=
10-
golang.org/x/tools v0.32.0/go.mod h1:ZxrU41P/wAbZD8EDa6dDCa6XfpkhJ7HFMjHJXfBDu8s=
7+
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
8+
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
9+
golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc=
10+
golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI=

plugin.go

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,24 @@
1717
package plugin
1818

1919
import (
20-
"fillmore-labs.com/zerolint/pkg/analyzer"
20+
"regexp"
21+
22+
"fillmore-labs.com/zerolint/pkg/zerolint"
23+
"fillmore-labs.com/zerolint/pkg/zerolint/level"
2124
"github.com/golangci/plugin-module-register/register"
2225
"golang.org/x/tools/go/analysis"
23-
"golang.org/x/tools/go/analysis/passes/inspect"
2426
)
2527

26-
// Name is the linters name.
27-
const Name = "zerolint"
28-
2928
func init() { //nolint:gochecknoinits
30-
register.Plugin(Name, New)
29+
register.Plugin(zerolint.Name, New)
3130
}
3231

3332
// Settings are the linters settings.
3433
type Settings struct {
35-
Excluded []string `json:"excluded"`
36-
Full bool `json:"full"`
34+
Excluded []string `json:"excluded,omitempty"`
35+
Level level.LintLevel `json:"level,omitempty"`
36+
Match *regexp.Regexp `json:"match,omitempty"`
37+
Generated bool `json:"generated,omitempty"`
3738
}
3839

3940
// New creates a new [Plugin] instance with the given [Settings].
@@ -53,20 +54,14 @@ type Plugin struct {
5354

5455
// BuildAnalyzers returns the [analysis.Analyzer]s for a zerolint run.
5556
func (p Plugin) BuildAnalyzers() ([]*analysis.Analyzer, error) {
56-
run := analyzer.NewRun(
57-
analyzer.WithExcludes(p.settings.Excluded),
58-
analyzer.WithFull(p.settings.Full),
59-
analyzer.WithGenerated(true),
57+
z := zerolint.New(
58+
zerolint.WithLevel(p.settings.Level),
59+
zerolint.WithExcludes(p.settings.Excluded),
60+
zerolint.WithRegex(p.settings.Match),
61+
zerolint.WithGenerated(p.settings.Generated),
6062
)
6163

62-
analyzer := &analysis.Analyzer{
63-
Name: Name,
64-
Doc: analyzer.Doc,
65-
Run: run,
66-
Requires: []*analysis.Analyzer{inspect.Analyzer},
67-
}
68-
69-
return []*analysis.Analyzer{analyzer}, nil
64+
return []*analysis.Analyzer{z}, nil
7065
}
7166

7267
// GetLoadMode returns the golangci load mode.

0 commit comments

Comments
 (0)