Skip to content

Commit 26cee86

Browse files
cardilCopilot
andauthored
✴️ Bump golang & lint (#52)
* Bump golangci-lint * golangci-lint 2.0 fixes * Apply suggestions from code review Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent d530f53 commit 26cee86

31 files changed

+201
-120
lines changed

.github/workflows/lint.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ jobs:
2424
- uses: actions/checkout@v4
2525
- uses: actions/setup-go@v5
2626
with:
27-
go-version: '1.22'
27+
go-version: '1.24'
2828
cache: false
29-
- uses: golangci/golangci-lint-action@v4
29+
- uses: golangci/golangci-lint-action@v7
3030
with:
3131
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
32-
version: v1.57.2
32+
version: v2.0.2
3333

3434
editorconfig:
3535
name: EditorConfig

.github/workflows/mage.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
matrix:
2525
go-version:
26-
- '1.22'
26+
- '1.24'
2727
steps:
2828

2929
- name: Set up Go ${{ matrix.go-version }}

.golangci.yaml

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,41 @@
1+
version: "2"
12
run:
2-
timeout: 5m
33
build-tags:
44
- e2e
55
- mage
66
- ignored
7-
87
linters:
9-
disable-all: false
10-
presets:
11-
- bugs
12-
- unused
13-
- complexity
14-
- format
15-
- performance
16-
- style
17-
enable:
18-
- gci
8+
default: all
199
disable:
20-
- paralleltest
21-
- nlreturn
22-
- wsl
10+
- containedctx
11+
- depguard
12+
- exhaustruct
2313
- godox
2414
- ireturn
15+
- nlreturn
16+
- paralleltest
2517
- varnamelen
26-
- exhaustruct
27-
- depguard
28-
- containedctx # TODO: consider removing this
29-
30-
issues:
31-
exclude-rules:
32-
- path: _test\.go
33-
linters:
34-
- wrapcheck
35-
36-
linters-settings:
37-
wrapcheck:
38-
ignorePackageGlobs:
39-
- github.com/openshift-knative/hack/*
40-
gomoddirectives:
41-
# List of allowed `replace` directives. Default is empty.
42-
replace-allow-list: []
18+
- wsl
19+
- nonamedreturns
20+
settings:
21+
wrapcheck:
22+
ignore-package-globs:
23+
- github.com/openshift-knative/hack/*
24+
exclusions:
25+
generated: lax
26+
presets:
27+
- comments
28+
- common-false-positives
29+
- legacy
30+
rules:
31+
- linters:
32+
- wrapcheck
33+
path: _test\.go
34+
formatters:
35+
enable:
36+
- gci
37+
- gofmt
38+
- gofumpt
39+
- goimports
40+
exclusions:
41+
generated: lax

build/Magefile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func init() { //nolint:gochecknoinits
3232
Resolver: git.NewVersionResolver(),
3333
},
3434
Artifacts: []config.Artifact{bin},
35-
Checks: []config.Task{checks.GolangCiLint(withVersion("v1.57.2"))},
35+
Checks: []config.Task{checks.GolangCiLint(withVersion("v2.0.2"))},
3636
})
3737
}
3838

build/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/openshift-knative/deviate/build
22

3-
go 1.22.9
3+
go 1.24.0
44

55
require (
66
github.com/openshift-knative/deviate v0.0.0

build/go.sum

Lines changed: 71 additions & 0 deletions
Large diffs are not rendered by default.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/openshift-knative/deviate
22

3-
go 1.22.9
3+
go 1.24.0
44

55
require (
66
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2

go.work

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
go 1.22.9
1+
go 1.24.0
22

33
use (
44
.

pkg/config/defaults.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func newDefaults(project Project) Config {
3737
RefSpec: "v*",
3838
},
3939
ResyncReleases: ResyncReleases{
40-
NumberOf: 6, //nolint:mnd,gomnd
40+
NumberOf: 6, //nolint:mnd
4141
},
4242
Messages: Messages{
4343
TriggerCI: ":robot: Synchronize branch `%s` to " +

pkg/errors/wrap.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,11 @@ func Is(err, target error) bool {
2323

2424
// New returns an error that formats as the given text.
2525
func New(text string) error {
26-
return errors.New(text) //nolint:goerr113
26+
return errors.New(text) //nolint:err113
27+
}
28+
29+
// Join returns an error that wraps the given errors.
30+
// Any nil error values are discarded.
31+
func Join(err ...error) error {
32+
return errors.Join(err...)
2733
}

0 commit comments

Comments
 (0)