Skip to content

Commit 62da86f

Browse files
committed
Upgrade GolangCI-lint to v2
1 parent 0e43b96 commit 62da86f

File tree

2 files changed

+122
-163
lines changed

2 files changed

+122
-163
lines changed

.golangci.yaml

Lines changed: 121 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -1,170 +1,129 @@
1+
version: "2"
12
run:
2-
timeout: 20m
3-
go: '1.24'
3+
go: "1.24"
44
modules-download-mode: vendor
55
allow-parallel-runners: true
6-
output:
7-
print-linter-name: true
8-
sort-results: true
96
linters:
107
enable:
11-
- asciicheck
12-
- containedctx
13-
- decorder
14-
- dogsled
15-
- errcheck
16-
- errorlint
17-
- copyloopvar
18-
- goconst
19-
- gocritic
20-
- gocyclo
21-
- godot
22-
- gofmt
23-
- goimports
24-
- gosec
25-
- gosimple
26-
- govet
27-
- importas
28-
- ineffassign
29-
- misspell
30-
- nakedret
31-
- prealloc
32-
- predeclared
33-
- revive
34-
- staticcheck
35-
- stylecheck
36-
- tenv
37-
- thelper
38-
- typecheck
39-
- unconvert
40-
- unused
41-
- whitespace
42-
linters-settings:
43-
gosec:
44-
excludes:
45-
# Potential integer overflow when converting between integer types
46-
- G115
47-
errcheck:
48-
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
49-
# Such cases aren't reported by default.
50-
# Default: false
51-
check-type-assertions: false
52-
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`.
53-
# Such cases aren't reported by default.
54-
# Default: false
55-
check-blank: true
56-
# DEPRECATED comma-separated list of pairs of the form pkg:regex
57-
#
58-
# the regex is used to ignore names within pkg. (default "fmt:.*").
59-
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
60-
# ignore: fmt:.*,io/ioutil:^Read.*
61-
# To disable the errcheck built-in exclude list.
62-
# See `-excludeonly` option in https://github.com/kisielk/errcheck#excluding-functions for details.
63-
# Default: false
64-
disable-default-exclusions: true
65-
# DEPRECATED use exclude-functions instead.
66-
#
67-
# Path to a file containing a list of functions to exclude from checking.
68-
# See https://github.com/kisielk/errcheck#excluding-functions for details.
69-
# exclude: /path/to/file.txt
70-
# List of functions to exclude from checking, where each entry is a single function to exclude.
71-
# See https://github.com/kisielk/errcheck#excluding-functions for details.
72-
exclude-functions:
73-
- io/ioutil.ReadFile
74-
- io.Copy(*bytes.Buffer)
75-
- io.Copy(os.Stdout)
76-
errorlint:
77-
# Check whether fmt.Errorf uses the %w verb for formatting errors.
78-
# See the https://github.com/polyfloyd/go-errorlint for caveats.
79-
# Default: true
80-
errorf: true
81-
# Check for plain type assertions and type switches.
82-
# Default: true
83-
asserts: true
84-
# Check for plain error comparisons.
85-
# Default: true
86-
comparison: true
87-
gci:
88-
# DEPRECATED: use `sections` and `prefix(github.com/org/project)` instead.
89-
# local-prefixes: github.com/org/project
90-
#
91-
# Section configuration to compare against.
92-
# Section names are case-insensitive and may contain parameters in ().
93-
# The default order of sections is `standard > default > custom > blank > dot`,
94-
# If `custom-order` is `true`, it follows the order of `sections` option.
95-
# Default: ["standard", "default"]
96-
sections:
97-
- standard # Standard section: captures all standard packages.
98-
- default # Default section: contains all imports that could not be matched to another section type.
99-
- prefix(github.com/openshift) # Custom section: groups all imports with the specified Prefix.
100-
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
101-
# - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
102-
# Skip generated files.
103-
# Default: true
104-
skip-generated: true
105-
# Enable custom order of sections.
106-
# If `true`, make the section order the same as the order of `sections`.
107-
# Default: false
108-
custom-order: true
109-
gofumpt:
110-
# Select the Go version to target.
111-
# Default: "1.15"
112-
# Deprecated: use the global `run.go` instead.
113-
# lang-version: "1.17"
114-
# Module path which contains the source code being formatted.
115-
# Default: ""
116-
module-path: github.com/openshift/installer
117-
# Choose whether to use the extra rules.
118-
# Default: false
119-
extra-rules: true
120-
goimports:
121-
# Put imports beginning with prefix after 3rd-party packages.
122-
# It's a comma-separated list of prefixes.
123-
# Default: ""
124-
local-prefixes: github.com/openshift
125-
revive:
8+
- asciicheck
9+
- containedctx
10+
- copyloopvar
11+
- decorder
12+
- dogsled
13+
- errorlint
14+
- goconst
15+
- gocritic
16+
- gocyclo
17+
- godot
18+
- gosec
19+
- importas
20+
- misspell
21+
- nakedret
22+
- prealloc
23+
- predeclared
24+
- revive
25+
- staticcheck
26+
- thelper
27+
- unconvert
28+
- whitespace
29+
settings:
30+
errcheck:
31+
disable-default-exclusions: true
32+
check-type-assertions: false
33+
check-blank: true
34+
exclude-functions:
35+
- io/ioutil.ReadFile
36+
- io.Copy(*bytes.Buffer)
37+
- io.Copy(os.Stdout)
38+
errorlint:
39+
errorf: true
40+
asserts: true
41+
comparison: true
42+
gosec:
43+
excludes:
44+
- G115
45+
revive:
46+
rules:
47+
- name: blank-imports
48+
- name: context-as-argument
49+
- name: context-keys-type
50+
- name: dot-imports
51+
- name: error-return
52+
- name: error-strings
53+
- name: error-naming
54+
- name: exported
55+
- name: if-return
56+
- name: increment-decrement
57+
- name: var-naming
58+
- name: var-declaration
59+
- name: range
60+
- name: receiver-naming
61+
- name: time-naming
62+
- name: unexported-return
63+
- name: indent-error-flow
64+
- name: errorf
65+
- name: superfluous-else
66+
- name: unreachable-code
67+
- name: redefines-builtin-id
68+
- name: bool-literal-in-expr
69+
- name: constant-logical-expr
70+
exclusions:
71+
generated: lax
72+
presets:
73+
- common-false-positives
74+
- legacy
75+
- std-error-handling
12676
rules:
127-
# The following rules are recommended https://github.com/mgechev/revive#recommended-configuration
128-
- name: blank-imports
129-
- name: context-as-argument
130-
- name: context-keys-type
131-
- name: dot-imports
132-
- name: error-return
133-
- name: error-strings
134-
- name: error-naming
135-
- name: exported
136-
- name: if-return
137-
- name: increment-decrement
138-
- name: var-naming
139-
- name: var-declaration
140-
- name: range
141-
- name: receiver-naming
142-
- name: time-naming
143-
- name: unexported-return
144-
- name: indent-error-flow
145-
- name: errorf
146-
- name: superfluous-else
147-
- name: unreachable-code
148-
- name: redefines-builtin-id
149-
- name: bool-literal-in-expr
150-
- name: constant-logical-expr
77+
- linters:
78+
- goconst
79+
path: _test\.go
80+
paths:
81+
- ^bin
82+
- ^cluster-api
83+
- ^data/data
84+
- ^docs
85+
- ^hack
86+
- ^images
87+
- ^scripts
88+
- ^terraform
89+
- ^upi
90+
- ^pkg/asset/manifests/azure/stack/v1beta1
91+
- third_party$
92+
- builtin$
93+
- examples$
15194
issues:
152-
include:
153-
- EXC0012 # EXC0012 revive: issue about not having a comment on exported.
154-
- EXC0014 # EXC0014 revive: issue about not having a comment in the right format.
155-
exclude-rules:
156-
- linters:
157-
- goconst
158-
path: _test\.go
159-
exclude-dirs:
160-
- ^bin
161-
- ^cluster-api
162-
- ^data/data
163-
- ^docs
164-
- ^hack
165-
- ^images
166-
- ^scripts
167-
- ^terraform
168-
- ^upi
169-
- ^pkg/asset/manifests/azure/stack/v1beta1 # local copy of capi azurestack provider fork api
17095
uniq-by-line: false
96+
formatters:
97+
enable:
98+
- gofmt
99+
- goimports
100+
settings:
101+
gci:
102+
sections:
103+
- standard
104+
- default
105+
- prefix(github.com/openshift)
106+
- blank
107+
custom-order: true
108+
gofumpt:
109+
module-path: github.com/openshift/installer
110+
extra-rules: true
111+
goimports:
112+
local-prefixes:
113+
- github.com/openshift
114+
exclusions:
115+
generated: lax
116+
paths:
117+
- ^bin
118+
- ^cluster-api
119+
- ^data/data
120+
- ^docs
121+
- ^hack
122+
- ^images
123+
- ^scripts
124+
- ^terraform
125+
- ^upi
126+
- ^pkg/asset/manifests/azure/stack/v1beta1
127+
- third_party$
128+
- builtin$
129+
- examples$

hack/go-lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ podman run --rm \
55
--env IS_CONTAINER=TRUE \
66
--volume "${PWD}:/go/src/github.com/openshift/installer:z" \
77
--workdir /go/src/github.com/openshift/installer \
8-
docker.io/golangci/golangci-lint:v1.64.8 \
8+
docker.io/golangci/golangci-lint:v2.6.2 \
99
golangci-lint run -v --new-from-rev=dcf8122 "${@}"

0 commit comments

Comments
 (0)