Skip to content

Commit 7ab11f8

Browse files
authored
chore: update go and dependencies
1 parent fc92f11 commit 7ab11f8

19 files changed

+166
-165
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
env:
1515
GO_VERSION: stable
16-
GOLANGCI_LINT_VERSION: v1.60.3
16+
GOLANGCI_LINT_VERSION: v2.4.0
1717
CGO_ENABLED: 0
1818

1919
steps:

.golangci.yml

Lines changed: 80 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,92 @@
1-
run:
2-
timeout: 2m
3-
4-
linters-settings:
5-
govet:
6-
enable:
7-
- shadow
8-
gocyclo:
9-
min-complexity: 23
10-
goconst:
11-
min-len: 3
12-
min-occurrences: 3
13-
misspell:
14-
locale: US
15-
depguard:
16-
rules:
17-
main:
18-
deny:
19-
- pkg: "github.com/instana/testify"
20-
desc: not allowed
21-
- pkg: "github.com/pkg/errors"
22-
desc: Should be replaced by standard lib errors package
23-
perfsprint:
24-
err-error: true
25-
errorf: true
26-
sprintf1: true
27-
strconcat: false
28-
1+
version: "2"
292
linters:
30-
enable-all: true
3+
default: all
314
disable:
32-
- exportloopref # Deprecated
33-
- execinquery # not relevant (SQL)
34-
- sqlclosecheck # not relevant (SQL)
35-
- rowserrcheck # not relevant (SQL)
36-
- cyclop # duplicate of gocyclo
37-
- mnd
385
- contextcheck
39-
- lll
6+
- cyclop
407
- dupl
41-
- prealloc
42-
- gomnd
43-
- wsl
44-
- nlreturn
45-
- gocognit
46-
- nestif
47-
- testpackage
48-
- paralleltest
49-
- tparallel
508
- err113
51-
- wrapcheck
529
- exhaustive
5310
- exhaustruct
11+
- gocognit
12+
- lll
13+
- mnd
14+
- nestif
15+
- nilnil
16+
- nlreturn
5417
- noctx
18+
- paralleltest
19+
- prealloc
20+
- rowserrcheck
21+
- sqlclosecheck
22+
- testpackage
23+
- tparallel
5524
- varnamelen
56-
- nilnil
57-
25+
- wrapcheck
26+
- wsl
27+
- wsl_v5
28+
settings:
29+
depguard:
30+
rules:
31+
main:
32+
deny:
33+
- pkg: github.com/instana/testify
34+
desc: not allowed
35+
- pkg: github.com/pkg/errors
36+
desc: Should be replaced by standard lib errors package
37+
goconst:
38+
min-len: 3
39+
min-occurrences: 3
40+
gocyclo:
41+
min-complexity: 23
42+
govet:
43+
enable:
44+
- shadow
45+
misspell:
46+
locale: US
47+
perfsprint:
48+
err-error: true
49+
errorf: true
50+
sprintf1: true
51+
strconcat: false
52+
exclusions:
53+
generated: lax
54+
rules:
55+
- linters:
56+
- funlen
57+
path: (.+)_test.go
58+
- path: cmd/version.go
59+
text: (version|date|commit) is a global variable
60+
- path: cmd/version.go
61+
text: use of `fmt.Printf` forbidden by pattern
62+
- path: pkg/repository/repository.go
63+
text: Function 'process' has too many statements \(\d+ > 40\)
64+
- path: pkg/repository/repository.go
65+
text: cyclomatic complexity \d+ of func `\(Repository\)\.Process` is high \(> 16\)
66+
- path: (.+)\.go$
67+
text: 'ST1000: at least one file in a package should have a package comment'
68+
- path: (.+)\.go$
69+
text: 'package-comments: should have a package comment'
70+
- path: (.+)\.go$
71+
text: 'G304: Potential file inclusion via variable'
72+
- path: (.+)\.go$
73+
text: 'G114: Use of net/http serve function that has no support for setting timeouts'
74+
paths:
75+
- third_party$
76+
- builtin$
77+
- examples$
5878
issues:
59-
exclude-use-default: false
6079
max-issues-per-linter: 0
6180
max-same-issues: 0
62-
exclude:
63-
- 'ST1000: at least one file in a package should have a package comment'
64-
- 'package-comments: should have a package comment'
65-
- "G304: Potential file inclusion via variable"
66-
- 'G114: Use of net/http serve function that has no support for setting timeouts'
67-
exclude-rules:
68-
- path: (.+)_test.go
69-
linters:
70-
- funlen
71-
- path: cmd/version.go
72-
text: (version|date|commit) is a global variable
73-
- path: cmd/version.go
74-
text: use of `fmt.Printf` forbidden by pattern
75-
# FIXME must be changed
76-
- path: pkg/repository/repository.go
77-
text: Function 'Process' has too many statements \(\d+ > 40\)
78-
# FIXME must be changed
79-
- path: pkg/repository/repository.go
80-
text: >-
81-
cyclomatic complexity \d+ of func `\(Repository\)\.Process` is high \(>
82-
16\)
81+
formatters:
82+
enable:
83+
- gci
84+
- gofmt
85+
- gofumpt
86+
- goimports
87+
exclusions:
88+
generated: lax
89+
paths:
90+
- third_party$
91+
- builtin$
92+
- examples$

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ default: clean check test build
1616
test: clean
1717
go test -v -cover ./...
1818

19+
lint:
20+
golangci-lint run
21+
1922
clean:
2023
rm -rf dist/ cover.out
2124

2225
build: clean
2326
@echo Version: $(VERSION) $(BUILD_DATE)
2427
CGO_ENABLED=0 go build -trimpath -ldflags '-s -w -X "main.version=${VERSION}" -X "main.commit=${SHA}" -X "main.date=${BUILD_DATE}"' -o ${BIN_OUTPUT} ./cmd/
2528

26-
check:
27-
golangci-lint run
28-
2929
release-test:
3030
goreleaser --skip=publish --snapshot --clean
3131

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"strconv"
1111
"strings"
1212

13-
"github.com/google/go-github/v58/github"
13+
"github.com/google/go-github/v74/github"
1414
"github.com/rs/zerolog"
1515
"github.com/rs/zerolog/log"
1616
"github.com/traefik/lobicornis/v3/pkg/conf"

go.mod

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
module github.com/traefik/lobicornis/v3
22

3-
go 1.23.0
3+
go 1.25.0
44

55
require (
6-
github.com/google/go-github/v58 v58.0.0
7-
github.com/ldez/go-git-cmd-wrapper/v2 v2.7.0
8-
github.com/rs/zerolog v1.33.0
9-
github.com/stretchr/testify v1.9.0
10-
golang.org/x/oauth2 v0.22.0
6+
github.com/google/go-github/v74 v74.0.0
7+
github.com/ldez/go-git-cmd-wrapper/v2 v2.9.1
8+
github.com/rs/zerolog v1.34.0
9+
github.com/stretchr/testify v1.11.1
10+
golang.org/x/oauth2 v0.30.0
1111
gopkg.in/yaml.v3 v3.0.1
1212
)
1313

1414
require (
1515
github.com/davecgh/go-spew v1.1.1 // indirect
1616
github.com/google/go-querystring v1.1.0 // indirect
17-
github.com/mattn/go-colorable v0.1.13 // indirect
17+
github.com/mattn/go-colorable v0.1.14 // indirect
1818
github.com/mattn/go-isatty v0.0.20 // indirect
1919
github.com/pmezard/go-difflib v1.0.0 // indirect
20-
golang.org/x/sys v0.24.0 // indirect
20+
golang.org/x/sys v0.35.0 // indirect
2121
)

go.sum

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,36 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
44
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
55
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
6-
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
7-
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
8-
github.com/google/go-github/v58 v58.0.0 h1:Una7GGERlF/37XfkPwpzYJe0Vp4dt2k1kCjlxwjIvzw=
9-
github.com/google/go-github/v58 v58.0.0/go.mod h1:k4hxDKEfoWpSqFlc8LTpGd9fu2KrV1YAa6Hi6FmDNY4=
6+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
7+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
8+
github.com/google/go-github/v74 v74.0.0 h1:yZcddTUn8DPbj11GxnMrNiAnXH14gNs559AsUpNpPgM=
9+
github.com/google/go-github/v74 v74.0.0/go.mod h1:ubn/YdyftV80VPSI26nSJvaEsTOnsjrxG3o9kJhcyak=
1010
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
1111
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
12-
github.com/ldez/go-git-cmd-wrapper/v2 v2.7.0 h1:p+ddlPLvlBy15FCy8b9P5RkO81i+I2uIPWjaq6D1lO0=
13-
github.com/ldez/go-git-cmd-wrapper/v2 v2.7.0/go.mod h1:0eUeas7XtKDPKQbB0KijfaMPbuQ/cIprtoTRiwaUoFg=
14-
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
12+
github.com/ldez/go-git-cmd-wrapper/v2 v2.9.1 h1:QJRB9Gs5i/h6TVJI6yl09Qm6rNooznRiKwIw+VIxd90=
13+
github.com/ldez/go-git-cmd-wrapper/v2 v2.9.1/go.mod h1:0eUeas7XtKDPKQbB0KijfaMPbuQ/cIprtoTRiwaUoFg=
1514
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
15+
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
16+
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
1617
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
1718
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
1819
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
1920
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
2021
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
2122
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
2223
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
23-
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
24-
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
25-
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
26-
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
27-
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
28-
golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA=
29-
golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
24+
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
25+
github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
26+
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
27+
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
28+
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
29+
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
30+
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
3031
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3132
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3233
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
33-
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
34-
golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
34+
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
35+
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
3536
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
3637
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
3738
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

pkg/repository/clone.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"strings"
77

8-
"github.com/google/go-github/v58/github"
8+
"github.com/google/go-github/v74/github"
99
"github.com/ldez/go-git-cmd-wrapper/v2/checkout"
1010
"github.com/ldez/go-git-cmd-wrapper/v2/clone"
1111
"github.com/ldez/go-git-cmd-wrapper/v2/config"

pkg/repository/clone_test.go

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"strings"
77
"testing"
88

9-
"github.com/google/go-github/v58/github"
9+
"github.com/google/go-github/v74/github"
1010
"github.com/ldez/go-git-cmd-wrapper/v2/git"
1111
"github.com/ldez/go-git-cmd-wrapper/v2/remote"
1212
"github.com/stretchr/testify/assert"
@@ -47,13 +47,8 @@ func TestClone_PullRequestForUpdate(t *testing.T) {
4747

4848
for _, test := range testCases {
4949
t.Run(test.name, func(t *testing.T) {
50-
dir, err := os.MkdirTemp("", "myrmica-lobicornis")
51-
require.NoError(t, err)
52-
53-
t.Cleanup(func() { _ = os.RemoveAll(dir) })
54-
55-
err = os.Chdir(dir)
56-
require.NoError(t, err)
50+
dir := t.TempDir()
51+
t.Chdir(dir)
5752

5853
tempDir, err := os.Getwd()
5954
require.NoError(t, err)
@@ -113,13 +108,8 @@ func TestClone_PullRequestForMerge(t *testing.T) {
113108

114109
for _, test := range testCases {
115110
t.Run(test.name, func(t *testing.T) {
116-
dir, err := os.MkdirTemp("", "myrmica-lobicornis")
117-
require.NoError(t, err)
118-
119-
t.Cleanup(func() { _ = os.RemoveAll(dir) })
120-
121-
err = os.Chdir(dir)
122-
require.NoError(t, err)
111+
dir := t.TempDir()
112+
t.Chdir(dir)
123113

124114
tempDir, err := os.Getwd()
125115
require.NoError(t, err)
@@ -194,28 +184,28 @@ func Test_makeRepositoryURL(t *testing.T) {
194184

195185
func createFakePR(sameRepo bool) *github.PullRequest {
196186
pr := &github.PullRequest{
197-
Number: github.Int(666),
187+
Number: github.Ptr(666),
198188
}
199189
pr.Base = &github.PullRequestBranch{
200190
Repo: &github.Repository{
201-
GitURL: github.String("git://github.com/traefik/traefik.git"),
191+
GitURL: github.Ptr("git://github.com/traefik/traefik.git"),
202192
},
203-
Ref: github.String("master"),
193+
Ref: github.Ptr("master"),
204194
}
205195

206196
if sameRepo {
207197
pr.Head = &github.PullRequestBranch{
208198
Repo: &github.Repository{
209-
GitURL: github.String("git://github.com/traefik/traefik.git"),
199+
GitURL: github.Ptr("git://github.com/traefik/traefik.git"),
210200
},
211-
Ref: github.String("v1.3"),
201+
Ref: github.Ptr("v1.3"),
212202
}
213203
} else {
214204
pr.Head = &github.PullRequestBranch{
215205
Repo: &github.Repository{
216-
GitURL: github.String("git://github.com/ldez/traefik.git"),
206+
GitURL: github.Ptr("git://github.com/ldez/traefik.git"),
217207
},
218-
Ref: github.String("v1.3"),
208+
Ref: github.Ptr("v1.3"),
219209
}
220210
}
221211

pkg/repository/mjolnir.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strconv"
88
"strings"
99

10-
"github.com/google/go-github/v58/github"
10+
"github.com/google/go-github/v74/github"
1111
"github.com/rs/zerolog/log"
1212
)
1313

@@ -85,7 +85,7 @@ func (m Mjolnir) closeIssue(ctx context.Context, pr *github.PullRequest, issueNu
8585

8686
issueRequest := &github.IssueRequest{
8787
Milestone: milestone,
88-
State: github.String("closed"),
88+
State: github.Ptr("closed"),
8989
}
9090

9191
_, _, err := m.client.Issues.Edit(ctx, m.owner, m.name, issueNumber, issueRequest)
@@ -94,7 +94,7 @@ func (m Mjolnir) closeIssue(ctx context.Context, pr *github.PullRequest, issueNu
9494

9595
func (m Mjolnir) addComment(ctx context.Context, issueNumber int, message string) error {
9696
issueComment := &github.IssueComment{
97-
Body: github.String(message),
97+
Body: github.Ptr(message),
9898
}
9999

100100
_, _, err := m.client.Issues.CreateComment(ctx, m.owner, m.name, issueNumber, issueComment)

0 commit comments

Comments
 (0)