Skip to content

Commit ba09374

Browse files
authored
chore: migrate golangci-lint to v2.3.0 (#765)
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent cc754e6 commit ba09374

22 files changed

+274
-1956
lines changed

.bingo/Variables.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ $(GOIMPORTS): $(BINGO_DIR)/goimports.mod
4141
@echo "(re)installing $(GOBIN)/goimports-v0.7.0"
4242
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=goimports.mod -o=$(GOBIN)/goimports-v0.7.0 "golang.org/x/tools/cmd/goimports"
4343

44-
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.64.5
44+
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v2.3.0
4545
$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
4646
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
47-
@echo "(re)installing $(GOBIN)/golangci-lint-v1.64.5"
48-
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.64.5 "github.com/golangci/golangci-lint/cmd/golangci-lint"
47+
@echo "(re)installing $(GOBIN)/golangci-lint-v2.3.0"
48+
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v2.3.0 "github.com/golangci/golangci-lint/v2/cmd/golangci-lint"
4949

5050
MDOX := $(GOBIN)/mdox-v0.9.0
5151
$(MDOX): $(BINGO_DIR)/mdox.mod

.bingo/golangci-lint.mod

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
22

3-
go 1.23.0
3+
go 1.24.5
44

5-
toolchain go1.24.0
6-
7-
require github.com/golangci/golangci-lint v1.64.5 // cmd/golangci-lint
5+
require github.com/golangci/golangci-lint/v2 v2.3.0 // cmd/golangci-lint

.bingo/golangci-lint.sum

Lines changed: 193 additions & 1875 deletions
Large diffs are not rendered by default.

.bingo/variables.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ COPYRIGHT="${GOBIN}/copyright-v0.0.0-20210326193628-425a09c04e05"
1616

1717
GOIMPORTS="${GOBIN}/goimports-v0.7.0"
1818

19-
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.64.5"
19+
GOLANGCI_LINT="${GOBIN}/golangci-lint-v2.3.0"
2020

2121
MDOX="${GOBIN}/mdox-v0.9.0"
2222

.golangci.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
---
2+
version: "2"
23

34
run:
4-
deadline: 5m
5+
timeout: 5m
56

6-
output:
7-
sort-results: true
7+
linters:
8+
settings:
9+
errcheck:
10+
exclude-functions:
11+
- (github.com/go-kit/log.Logger).Log
12+
exclusions:
13+
presets:
14+
- comments
15+
- common-false-positives
16+
- legacy
17+
- std-error-handling
818

9-
linters-settings:
10-
errcheck:
11-
exclude: errcheck_excludes.txt
12-
gofumpt:
13-
extra-rules: true
19+
formatters:
20+
enable:
21+
- gofumpt
22+
- goimports
23+
settings:
24+
gofumpt:
25+
extra-rules: true

errcheck_excludes.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/client/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ func main() {
118118
return err
119119
}
120120
}
121-
122121
}, func(err error) {
123122
cancel()
124123
})

interceptors/auth/auth_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var (
3232

3333
// TODO(mwitkow): Add auth from metadata client dialer, which requires TLS.
3434

35-
func buildDummyAuthFunction(expectedScheme string, expectedToken string) func(ctx context.Context) (context.Context, error) {
35+
func buildDummyAuthFunction(expectedScheme, expectedToken string) func(ctx context.Context) (context.Context, error) {
3636
return func(ctx context.Context) (context.Context, error) {
3737
token, err := auth.AuthFromMD(ctx, expectedScheme)
3838
if err != nil {
@@ -64,7 +64,7 @@ func (s *assertingPingService) PingList(ping *testpb.PingListRequest, stream tes
6464
return s.TestServiceServer.PingList(ping, stream)
6565
}
6666

67-
func ctxWithToken(ctx context.Context, scheme string, token string) context.Context {
67+
func ctxWithToken(ctx context.Context, scheme, token string) context.Context {
6868
md := grpcMetadata.Pairs("authorization", fmt.Sprintf("%s %v", scheme, token))
6969
return metadata.MD(md).ToOutgoing(ctx)
7070
}

interceptors/callmeta.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func NewServerCallMeta(fullMethod string, streamInfo *grpc.StreamServerInfo, req
4343
c.Service, c.Method = splitFullMethodName(fullMethod)
4444
return c
4545
}
46+
4647
func (c CallMeta) FullMethod() string {
4748
return fmt.Sprintf("/%s/%s", c.Service, c.Method)
4849
}

interceptors/client_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ func (m *mockReportable) Equal(t *testing.T, expected []*mockReport) {
7171
}
7272

7373
}
74-
7574
}
7675

7776
func (m *mockReportable) requireOneReportWithRetry(ctx context.Context, t *testing.T, expected *mockReport) {
@@ -303,10 +302,8 @@ func (s *ClientInterceptorTestSuite) TestBiStreamingReporting() {
303302
wg.Add(1)
304303
go func() {
305304
defer wg.Done()
306-
for {
307-
if s.ctx.Err() != nil {
308-
break
309-
}
305+
for s.ctx.Err() == nil {
306+
310307
_, err := ss.Recv()
311308
if err == io.EOF {
312309
break

0 commit comments

Comments
 (0)