Skip to content

Commit 53edbe3

Browse files
authored
chore: upgrade golangci-lint to v2.1.6 (#113)
Upgrades golangci-lint from v1.64.5 to v2.1.6. This involves updating the version in the Makefile and migrating the .golangci.yaml configuration to the new v2 format. This includes adjustments to linter and formatter setups. A boolean expression was fixed by the linter in main.go. Previously the linter config had a typo, which caused settings for 'lll' and 'misspell' to not get applied. This was caused by a typo in the key name "linter-settings", which should have been "linters-settings". Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
1 parent 0c01f1c commit 53edbe3

File tree

3 files changed

+37
-25
lines changed

3 files changed

+37
-25
lines changed

.golangci.yaml

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
1-
run:
2-
timeout: 5m
3-
4-
linter-settings:
5-
lll:
6-
line-length: 200
7-
8-
misspell:
9-
locale: US
10-
1+
version: "2"
112
linters:
12-
disable-all: true
3+
default: none
134
enable:
14-
- errcheck
15-
- govet
16-
- ineffassign
17-
- revive # replacement for golint
18-
- gofmt
19-
- goimports
20-
- unused
21-
- misspell
22-
- typecheck
23-
- staticcheck
24-
- gosimple
25-
# - gosec # too many false positives
5+
- errcheck
6+
- govet
7+
- ineffassign
8+
- misspell
9+
- revive
10+
- staticcheck
11+
- unused
12+
settings:
13+
lll:
14+
line-length: 200
15+
misspell:
16+
locale: US
17+
exclusions:
18+
generated: lax
19+
presets:
20+
- comments
21+
- common-false-positives
22+
- legacy
23+
- std-error-handling
24+
paths:
25+
- third_party$
26+
- builtin$
27+
- examples$
28+
formatters:
29+
enable:
30+
- gofmt
31+
- goimports
32+
exclusions:
33+
generated: lax
34+
paths:
35+
- third_party$
36+
- builtin$
37+
- examples$

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
VERSION ?= 0.9
44
GO_VERSION := 1.24.3
5-
GOLANGCI_LINT_VERSION := v1.64.5
5+
GOLANGCI_LINT_VERSION := v2.1.6
66
REPO ?= openpolicyagent/opa-docker-authz-v2
77

88
REGAL_FORMAT ?= pretty

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func (p DockerAuthZPlugin) evaluatePolicyFile(ctx context.Context, r authorizati
133133
log.Printf("Returning OPA policy decision: %v (error: '%v'; input: '%v')", allowed, err, string(i))
134134
} else {
135135
if !p.quiet {
136-
if !(p.logOnlyDenied && allowed) {
136+
if !p.logOnlyDenied || !allowed {
137137
dl, _ := json.Marshal(decisionLog)
138138
log.Printf("Returning OPA policy decision: %v: %s", allowed, string(dl))
139139
}

0 commit comments

Comments
 (0)