Skip to content

Commit fb7e335

Browse files
authored
chores: major upgrade of golangci-lint from v1.64.8 to v2.1.6 (oauth2-proxy#3062)
.golangci.yml migrated with "golangci-lint migrated" and then tweaked to add comments back.
1 parent 1225d61 commit fb7e335

3 files changed

Lines changed: 59 additions & 44 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Get dependencies
2626
env:
2727
# renovate: datasource=github-tags depName=golangci/golangci-lint
28-
GOLANGCI_LINT_VERSION: v1.64.8
28+
GOLANGCI_LINT_VERSION: v2.1.6
2929
run: |
3030
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
3131
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter

.github/workflows/publish-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
- name: Get dependencies
5151
env:
5252
# renovate: datasource=github-tags depName=golangci/golangci-lint
53-
GOLANGCI_LINT_VERSION: v1.64.8
53+
GOLANGCI_LINT_VERSION: v2.1.6
5454
run: |
5555
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
5656
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter

.golangci.yml

Lines changed: 57 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,65 @@
1-
run:
2-
timeout: 120s
1+
version: "2"
32
linters:
3+
default: none
44
enable:
5-
- govet
6-
- ineffassign
7-
- goconst
8-
- gofmt
9-
- goimports
10-
- gosec
11-
- gosimple
12-
- staticcheck
13-
- typecheck
14-
- unused
155
- bodyclose
6+
- copyloopvar
167
- dogsled
8+
- goconst
9+
- gocritic
1710
- goprintffuncname
11+
- gosec
12+
- govet
13+
- ineffassign
1814
- misspell
1915
- prealloc
20-
- copyloopvar
21-
- stylecheck
22-
- unconvert
23-
- gocritic
2416
- revive
25-
disable-all: true
26-
issues:
27-
exclude:
28-
# To ease migration to golangci-lint v2.1
29-
# https://staticcheck.dev/docs/checks/#QF1008
30-
- QF1008
31-
exclude-rules:
32-
- path: _test\.go
33-
linters:
34-
- scopelint
35-
- bodyclose
36-
- unconvert
37-
- gocritic
38-
- gosec
39-
- goconst
40-
- revive
41-
- path: _test\.go
42-
linters:
43-
- revive
44-
text: "dot-imports:"
45-
# If we have tests in shared test folders, these can be less strictly linted
46-
- path: tests/.*_tests\.go
47-
linters:
48-
- revive
49-
- bodyclose
50-
- stylecheck
17+
- staticcheck
18+
- unconvert
19+
- unused
20+
exclusions:
21+
generated: lax
22+
presets:
23+
- comments
24+
- common-false-positives
25+
- legacy
26+
- std-error-handling
27+
rules:
28+
- linters:
29+
- bodyclose
30+
- goconst
31+
- gocritic
32+
- gosec
33+
- revive
34+
- scopelint
35+
- unconvert
36+
path: _test\.go
37+
- linters:
38+
- revive
39+
path: _test\.go
40+
text: 'dot-imports:'
41+
# # If we have tests in shared test folders, these can be less strictly linted
42+
- linters:
43+
- bodyclose
44+
- revive
45+
- staticcheck
46+
path: tests/.*_tests\.go
47+
# See https://github.com/oauth2-proxy/oauth2-proxy/issues/3060
48+
# https://staticcheck.dev/docs/checks/#QF1008
49+
- linters:
50+
- staticcheck
51+
text: QF1008
52+
paths:
53+
- third_party$
54+
- builtin$
55+
- examples$
56+
formatters:
57+
enable:
58+
- gofmt
59+
- goimports
60+
exclusions:
61+
generated: lax
62+
paths:
63+
- third_party$
64+
- builtin$
65+
- examples$

0 commit comments

Comments
 (0)