Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Commit 4e74edf

Browse files
authored
linter fixes (#132)
* upd to bbolt v1.4.0 * go.mod * save * fix inamedparam * fix nonamedreturns * fix dupword * fix import ordering * fix wsl * fix godox * fix funlen * fix lll * fix gocognit * fix cyclop * fix protogetter * updated .golangci.yaml * upd linter v2 * return ScanIterator instance not Iterator interface
1 parent ff3f948 commit 4e74edf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+880
-660
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ env:
1717
VAULT_ADDR: https://vault.eng.aserto.com/
1818
PRE_RELEASE: ${{ github.ref == 'refs/heads/main' && 'development' || '' }}
1919
GO_VERSION: "1.24"
20-
GO_RELEASER_VERSION: "v2.3.2"
21-
GO_LANGCI_LINT_VERSION: "v1.64.5"
22-
GO_TESTSUM_VERSION: "1.11.0"
20+
GO_RELEASER_VERSION: "v2.8.2"
21+
GO_LANGCI_LINT_VERSION: "v2.0.2"
22+
GO_TESTSUM_VERSION: "1.12.1"
2323

2424
jobs:
2525
test:
@@ -36,7 +36,7 @@ jobs:
3636
go-version: ${{ env.GO_VERSION }}
3737
-
3838
name: Lint
39-
uses: golangci/golangci-lint-action@v6
39+
uses: golangci/golangci-lint-action@v7
4040
with:
4141
version: ${{ env.GO_LANGCI_LINT_VERSION }}
4242
args: --timeout=30m

.golangci.yaml

Lines changed: 148 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,155 @@
11
---
2-
# golangci.com configuration
3-
# https://github.com/golangci/golangci/wiki/Configuration
4-
5-
run:
6-
timeout: 5m
7-
8-
linters-settings:
9-
dupl:
10-
threshold: 100
11-
funlen:
12-
lines: 100
13-
statements: 80
14-
goconst:
15-
min-len: 2
16-
min-occurrences: 2
17-
gocritic:
18-
enabled-tags:
19-
- diagnostic
20-
- experimental
21-
- opinionated
22-
- performance
23-
- style
24-
disabled-checks:
25-
- dupImport # https://github.com/go-critic/go-critic/issues/845
26-
- ifElseChain
27-
- octalLiteral
28-
- whyNoLint
29-
- wrapperFunc
30-
gocyclo:
31-
min-complexity: 18
32-
goimports:
33-
local-prefixes: github.com/golangci/golangci-lint
34-
govet:
35-
settings:
36-
printf:
37-
funcs:
38-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
39-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
40-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
41-
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
42-
misspell:
43-
locale: US
44-
nolintlint:
45-
allow-unused: false # report any unused nolint directives
46-
require-explanation: false # don't require an explanation for nolint directives
47-
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
2+
# Configuration
3+
# https://golangci-lint.run/usage/configuration/
4+
5+
version: "2"
486

497
linters:
50-
# please, do not use `enable-all`: it's deprecated and will be removed soon.
51-
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
52-
disable-all: true
53-
enable:
54-
- asciicheck
55-
- bodyclose
56-
- copyloopvar
57-
- dogsled
8+
# https://golangci-lint.run/usage/configuration/#linters-configuration
9+
default: all
10+
11+
# explicitly disabled linters
12+
disable:
13+
- containedctx
14+
- contextcheck
15+
- cyclop
16+
- depguard
5817
- errcheck
59-
- errname
18+
- exhaustruct
6019
- exhaustive
61-
- funlen
62-
- gochecknoinits
63-
- goconst
64-
- gocritic
65-
- gocyclo
66-
- godot
67-
- gosimple
68-
- err113
20+
- forbidigo
21+
- gochecknoglobals # no configuration options
22+
- nilnil
23+
- nlreturn # redundant with wsl
24+
- paralleltest
25+
- revive
26+
- tagalign
27+
- thelper
28+
- varnamelen
29+
- wrapcheck
30+
31+
exclusions:
32+
generated: lax
33+
34+
rules:
35+
- path: pkg/app/tests/
36+
linters:
37+
- dupl
38+
- forbidigo
39+
- wsl
40+
41+
- path: internal/pkg/xdg/
42+
linters:
43+
- gochecknoinits
44+
- gosec
45+
- mnd
46+
- testableexamples
47+
- testifylint
48+
- usetesting
49+
- wsl
50+
51+
- path: pkg/cc/signals/
52+
linters:
53+
- mnd
54+
55+
- path: pkg/cli/cmd/
56+
linters:
57+
- dupl
58+
59+
- path: pkg/cli/editor/
60+
linters:
61+
- dupword
62+
- errcheck
63+
- errorlint
64+
- forcetypeassert
65+
- gocritic
66+
- godox
67+
- gosec
68+
- mnd
69+
- ireturn
70+
- lll
71+
- makezero
72+
- nonamedreturns
73+
- recvcheck
74+
- wsl
75+
76+
- path: pkg/app/handlers/authorizer.go
77+
linters:
78+
- tagliatelle
79+
80+
- path: pkg/app/handlers/config.go
81+
linters:
82+
- tagliatelle
83+
84+
- path: cmd/topaz-db/
85+
linters:
86+
- staticcheck
87+
88+
- path: tests/
89+
linters:
90+
- dupl
91+
92+
settings:
93+
cyclop:
94+
max-complexity: 12
95+
96+
errcheck:
97+
exclude-functions:
98+
- fmt.Fprint
99+
- fmt.Fprintf
100+
- fmt.Fprintln
101+
- os.Close
102+
103+
funlen:
104+
lines: 80
105+
statements: 60
106+
ignore-comments: true
107+
108+
gomoddirectives:
109+
replace-allow-list:
110+
- github.com/slok/go-http-metrics
111+
112+
gosec:
113+
excludes:
114+
- G104 # Errors unhandled
115+
- G304 # Potential file inclusion via variable (see https://github.com/golang/go/issues/67002)
116+
117+
ireturn:
118+
allow:
119+
# stdlib
120+
- anon
121+
- error
122+
- empty
123+
- stdlib
124+
- generic
125+
- context.Context
126+
- http.Handler
127+
- io.Reader
128+
# 3rd-party
129+
- proto.Message
130+
- v1.AccessServer
131+
- v3.ModelServer
132+
- v3.ReaderServer
133+
- v3.WriterServer
134+
- v3.ExporterServer
135+
- v3.ImporterServer
136+
- datasync.SyncClient
137+
138+
lll:
139+
line-length: 150
140+
141+
# recvcheck:
142+
# exclusions:
143+
# - "*.UnmarshalGQL"
144+
145+
tagliatelle:
146+
case:
147+
rules:
148+
json: snake
149+
yaml: snake
150+
151+
formatters:
152+
enable:
69153
- gofmt
154+
- gofumpt
70155
- goimports
71-
- goprintffuncname
72-
- gosec
73-
- gosimple
74-
- govet
75-
- importas
76-
- ineffassign
77-
- misspell
78-
- nakedret
79-
- noctx
80-
- rowserrcheck
81-
- staticcheck
82-
- stylecheck
83-
- testifylint
84-
- testpackage
85-
- typecheck
86-
- unconvert
87-
- unparam
88-
- unused
89-
- wastedassign
90-
91-
# don't enable:
92-
# - depguard
93-
# - dupl
94-
# - gochecknoglobals
95-
# - gocognit
96-
# - godox
97-
# - gomnd
98-
# - lll
99-
# - nestif
100-
# - nolintlint # conflict with 1.19 gofmt changes
101-
# - prealloc
102-
# - revive
103-
# - wsl
104-
# - whitespace
105-
106-
issues:
107-
# List of regexps of issue texts to exclude, empty list by default.
108-
# But independently from this option we use default exclude patterns,
109-
# it can be disabled by `exclude-use-default: false`. To list all
110-
# excluded by default patterns execute `golangci-lint run --help`
111-
exclude:
112-
- declaration of "(err|ctx)" shadows declaration at
113-
- shadow of imported from 'github.com/stretchr/testify/assert' package 'assert'
114-
# Excluding configuration per-path, per-linter, per-text and per-source
115-
exclude-rules:
116-
- path: _test\.go
117-
linters:
118-
- gomnd
119-
# https://github.com/go-critic/go-critic/issues/926
120-
- text: "unnecessaryDefer:"
121-
linters:
122-
- gocritic
123-
- text: "unnamedResult:"
124-
linters:
125-
- gocritic
126-
- path: \.resolvers\.go
127-
text: "typeDefFirst:"
128-
linters:
129-
- gocritic
130-
- path: \.resolvers\.go
131-
text: "paramTypeCombine:"
132-
linters:
133-
- gocritic
134-
- path: \.resolvers\.go
135-
text: "hugeParam:"
136-
linters:
137-
- gocritic
138-
# integer overflow conversion
139-
- text: "G115"
140-
linters:
141-
- gosec
142-
- text: "G404"
143-
linters:
144-
- gosec
145-
- text: "SA1019: \\S+ is deprecated"
146-
linters:
147-
- staticcheck

go.mod

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ require (
2323
github.com/samber/lo v1.49.1
2424
github.com/stretchr/testify v1.10.0
2525
go.etcd.io/bbolt v1.4.0
26-
golang.org/x/sync v0.12.0
27-
google.golang.org/grpc v1.71.0
26+
golang.org/x/sync v0.13.0
27+
google.golang.org/grpc v1.71.1
2828
google.golang.org/protobuf v1.36.6
2929
)
3030

@@ -54,13 +54,13 @@ require (
5454
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
5555
github.com/texttheater/golang-levenshtein v1.0.1 // indirect
5656
github.com/virtuald/go-ordered-json v0.0.0-20170621173500-b18e6e673d74 // indirect
57-
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
58-
golang.org/x/net v0.37.0 // indirect
59-
golang.org/x/sys v0.31.0 // indirect
60-
golang.org/x/term v0.30.0 // indirect
61-
golang.org/x/text v0.23.0 // indirect
62-
google.golang.org/genproto/googleapis/api v0.0.0-20250324211829-b45e905df463 // indirect
63-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect
57+
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
58+
golang.org/x/net v0.39.0 // indirect
59+
golang.org/x/sys v0.32.0 // indirect
60+
golang.org/x/term v0.31.0 // indirect
61+
golang.org/x/text v0.24.0 // indirect
62+
google.golang.org/genproto/googleapis/api v0.0.0-20250407143221-ac9807e6c755 // indirect
63+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250407143221-ac9807e6c755 // indirect
6464
gopkg.in/yaml.v2 v2.4.0 // indirect
6565
gopkg.in/yaml.v3 v3.0.1 // indirect
6666
)

0 commit comments

Comments
 (0)