Skip to content

Commit 420829c

Browse files
Golangci lint migration (#949)
* Update dependency golangci/golangci-lint to v2 | datasource | package | from | to | | ----------- | ---------------------- | ------- | ------ | | github-tags | golangci/golangci-lint | v1.64.8 | v2.1.5 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * migrate golangci-lint config to v2 * apply De Morgan's laws https://en.wikipedia.org/wiki/De_Morgan%27s_laws * Update golangci/golangci-lint-action action to v7 | datasource | package | from | to | | ----------- | ----------------------------- | ------ | ------ | | github-tags | golangci/golangci-lint-action | v6.5.2 | v7.0.0 | Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --------- Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
1 parent bfc2724 commit 420829c

File tree

6 files changed

+69
-56
lines changed

6 files changed

+69
-56
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030
go-version: stable
3131

3232
- name: Lint Go
33-
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
33+
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
3434
with:
35-
version: v1.64.8 # renovate: datasource=github-tags depName=golangci/golangci-lint
35+
version: v2.1.5 # renovate: datasource=github-tags depName=golangci/golangci-lint
3636

3737
actionlint:
3838
name: Actionlint

.golangci.yml

Lines changed: 63 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,6 @@
1-
linters-settings:
2-
misspell:
3-
locale: US
4-
revive:
5-
ignore-generated-header: true
6-
rules:
7-
- name: blank-imports
8-
- name: constant-logical-expr
9-
- name: context-as-argument
10-
- name: context-keys-type
11-
- name: defer
12-
- name: dot-imports
13-
- name: duplicated-imports
14-
- name: empty-block
15-
- name: error-naming
16-
- name: error-return
17-
- name: error-strings
18-
- name: errorf
19-
- name: exported
20-
- name: import-shadowing
21-
- name: increment-decrement
22-
- name: indent-error-flow
23-
- name: package-comments
24-
- name: range
25-
- name: range-val-address
26-
- name: range-val-in-closure
27-
- name: receiver-naming
28-
- name: redefines-builtin-id
29-
- name: string-of-int
30-
- name: superfluous-else
31-
- name: time-naming
32-
- name: unchecked-type-assertion
33-
- name: unexported-return
34-
- name: unnecessary-stmt
35-
- name: unreachable-code
36-
- name: unused-parameter
37-
- name: var-declaration
38-
- name: var-naming
39-
govet:
40-
enable-all: true
1+
version: "2"
412
linters:
3+
default: none
424
enable:
435
- asasalint
446
- asciicheck
@@ -58,11 +20,7 @@ linters:
5820
- gochecksumtype
5921
- gocritic
6022
- godot
61-
- gofmt
62-
- gofumpt
63-
- goimports
6423
- gosec
65-
- gosimple
6624
- gosmopolitan
6725
- govet
6826
- ineffassign
@@ -83,23 +41,78 @@ linters:
8341
- reassign
8442
- revive
8543
- staticcheck
86-
- stylecheck
8744
- tagalign
88-
- tenv
8945
- testpackage
9046
- thelper
9147
- tparallel
92-
- typecheck
9348
- unconvert
9449
- unparam
9550
- unused
9651
- usestdlibvars
9752
- wastedassign
9853
- whitespace
9954
- wrapcheck
100-
disable-all: true
55+
settings:
56+
govet:
57+
enable-all: true
58+
misspell:
59+
locale: US
60+
revive:
61+
rules:
62+
- name: blank-imports
63+
- name: constant-logical-expr
64+
- name: context-as-argument
65+
- name: context-keys-type
66+
- name: defer
67+
- name: dot-imports
68+
- name: duplicated-imports
69+
- name: empty-block
70+
- name: error-naming
71+
- name: error-return
72+
- name: error-strings
73+
- name: errorf
74+
- name: exported
75+
- name: import-shadowing
76+
- name: increment-decrement
77+
- name: indent-error-flow
78+
- name: package-comments
79+
- name: range
80+
- name: range-val-address
81+
- name: range-val-in-closure
82+
- name: receiver-naming
83+
- name: redefines-builtin-id
84+
- name: string-of-int
85+
- name: superfluous-else
86+
- name: time-naming
87+
- name: unchecked-type-assertion
88+
- name: unexported-return
89+
- name: unnecessary-stmt
90+
- name: unreachable-code
91+
- name: unused-parameter
92+
- name: var-declaration
93+
- name: var-naming
94+
exclusions:
95+
generated: lax
96+
presets:
97+
- comments
98+
- common-false-positives
99+
- legacy
100+
- std-error-handling
101+
paths:
102+
- third_party$
103+
- builtin$
104+
- examples$
101105
issues:
102106
max-issues-per-linter: 0
103107
max-same-issues: 0
104-
run:
105-
timeout: 5m
108+
formatters:
109+
enable:
110+
- gofmt
111+
- gofumpt
112+
- goimports
113+
exclusions:
114+
generated: lax
115+
paths:
116+
- third_party$
117+
- builtin$
118+
- examples$

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ repos:
3030
- id: detect-private-key
3131

3232
- repo: https://github.com/golangci/golangci-lint
33-
rev: v1.64.8
33+
rev: v2.1.5
3434
hooks:
3535
- id: golangci-lint-full
3636

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.DEFAULT_GOAL := build-goreleaser
22
# renovate: datasource=github-tags depName=golangci/golangci-lint
3-
GOLANGCI_LINT_VERSION = v1.64.8
3+
GOLANGCI_LINT_VERSION = v2.1.5
44
# renovate: datasource=docker depName=goreleaser/goreleaser
55
GORELEASER_VERSION = v2.9.0
66
# renovate: datasource=go depName=google/go-licenses

cmd/sync/aws.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func validateAWSConfig(cfg *awsConfig) error {
275275
if ups.Port == 0 {
276276
return fmt.Errorf(upstreamPortErrorMsgFormat, ups.Name)
277277
}
278-
if ups.Kind == "" || !(ups.Kind == "http" || ups.Kind == "stream") {
278+
if ups.Kind == "" || (ups.Kind != "http" && ups.Kind != "stream") {
279279
return fmt.Errorf(upstreamKindErrorMsgFormat, ups.Name)
280280
}
281281
if ups.MaxConns < 0 {

cmd/sync/azure.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func validateAzureConfig(cfg *azureConfig) error {
203203
if ups.Port == 0 {
204204
return fmt.Errorf(upstreamPortErrorMsgFormat, ups.Name)
205205
}
206-
if ups.Kind == "" || !(ups.Kind == "http" || ups.Kind == "stream") {
206+
if ups.Kind == "" || (ups.Kind != "http" && ups.Kind != "stream") {
207207
return fmt.Errorf(upstreamKindErrorMsgFormat, ups.Name)
208208
}
209209
if ups.MaxConns < 0 {

0 commit comments

Comments
 (0)