Skip to content

Commit 81ec505

Browse files
author
sapcc-bot
committed
Run go-makefile-maker
1 parent ec238f4 commit 81ec505

File tree

3 files changed

+164
-118
lines changed

3 files changed

+164
-118
lines changed

.editorconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SPDX-FileCopyrightText: SAP SE
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
root = true
5+
6+
[*]
7+
insert_final_newline = true
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
indent_style = space
11+
indent_size = 2
12+
13+
[{Makefile,go.mod,go.sum,*.go}]
14+
indent_style = tab
15+
indent_size = 2
16+
17+
[*.md]
18+
trim_trailing_whitespace = false
19+
20+
[{LICENSE,LICENSES/*,vendor/**}]
21+
charset = unset
22+
end_of_line = unset
23+
indent_size = unset
24+
indent_style = unset
25+
insert_final_newline = unset
26+
trim_trailing_whitespace = unset

.github/workflows/checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
check-latest: true
3232
go-version: 1.24.1
3333
- name: Run golangci-lint
34-
uses: golangci/golangci-lint-action@v6
34+
uses: golangci/golangci-lint-action@v7
3535
with:
3636
version: latest
3737
- name: Dependency Licenses Review

.golangci.yaml

Lines changed: 137 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -6,127 +6,35 @@
66
# Copyright 2024 SAP SE
77
# SPDX-License-Identifier: Apache-2.0
88

9+
version: "2"
910
run:
10-
timeout: 3m0s # 1m by default
1111
modules-download-mode: readonly
12+
timeout: 3m0s # none by default in v2
1213

13-
output:
14-
# Do not print lines of code with issue.
15-
print-issued-lines: false
14+
formatters:
15+
enable:
16+
- gofmt
17+
- goimports
18+
settings:
19+
goimports:
20+
# Put local imports after 3rd-party packages
21+
local-prefixes:
22+
- github.com/sapcc/maintenance-controller
23+
exclusions:
24+
generated: lax
25+
paths:
26+
- third_party$
27+
- builtin$
28+
- examples$
1629

1730
issues:
18-
exclude:
19-
# It is idiomatic Go to reuse the name 'err' with ':=' for subsequent errors.
20-
# Ref: https://go.dev/doc/effective_go#redeclaration
21-
- 'declaration of "err" shadows declaration at'
22-
exclude-rules:
23-
- path: _test\.go
24-
linters:
25-
- bodyclose
26-
# '0' disables the following options.
31+
# '0' disables the following options
2732
max-issues-per-linter: 0
2833
max-same-issues: 0
2934

30-
linters-settings:
31-
errcheck:
32-
# Report about assignment of errors to blank identifier.
33-
check-blank: true
34-
# Do not report about not checking of errors in type assertions.
35-
# This is not as dangerous as skipping error values because an unchecked type assertion just immediately panics.
36-
# We disable this because it makes a ton of useless noise esp. in test code.
37-
check-type-assertions: false
38-
forbidigo:
39-
analyze-types: true # required for pkg:
40-
forbid:
41-
# ioutil package has been deprecated: https://github.com/golang/go/issues/42026
42-
- ^ioutil\..*$
43-
# Using http.DefaultServeMux is discouraged because it's a global variable that some packages silently and magically add handlers to (esp. net/http/pprof).
44-
# Applications wishing to use http.ServeMux should obtain local instances through http.NewServeMux() instead of using the global default instance.
45-
- ^http\.DefaultServeMux$
46-
- ^http\.Handle(?:Func)?$
47-
# Forbid usage of old and archived square/go-jose
48-
- pkg: ^gopkg\.in/square/go-jose\.v2$
49-
msg: "gopk.in/square/go-jose is archived and has CVEs. Replace it with gopkg.in/go-jose/go-jose.v2"
50-
- pkg: ^github.com/coreos/go-oidc$
51-
msg: "github.com/coreos/go-oidc depends on gopkg.in/square/go-jose which has CVEs. Replace it with github.com/coreos/go-oidc/v3"
52-
53-
- pkg: ^github.com/howeyc/gopass$
54-
msg: "github.com/howeyc/gopass is archived, use golang.org/x/term instead"
55-
goconst:
56-
ignore-tests: true
57-
min-occurrences: 5
58-
gocritic:
59-
enabled-checks:
60-
- boolExprSimplify
61-
- builtinShadow
62-
- emptyStringTest
63-
- evalOrder
64-
- httpNoBody
65-
- importShadow
66-
- initClause
67-
- methodExprCall
68-
- paramTypeCombine
69-
- preferFilepathJoin
70-
- ptrToRefParam
71-
- redundantSprint
72-
- returnAfterHttpError
73-
- stringConcatSimplify
74-
- timeExprSimplify
75-
- truncateCmp
76-
- typeAssertChain
77-
- typeUnparen
78-
- unnamedResult
79-
- unnecessaryBlock
80-
- unnecessaryDefer
81-
- weakCond
82-
- yodaStyleExpr
83-
goimports:
84-
# Put local imports after 3rd-party packages.
85-
local-prefixes: github.com/sapcc/maintenance-controller
86-
gomoddirectives:
87-
go-version-pattern: '1\.\d+(\.0)?$'
88-
replace-allow-list:
89-
# for go-pmtud
90-
- github.com/mdlayher/arp
91-
toolchain-forbidden: true
92-
gosec:
93-
excludes:
94-
# gosec wants us to set a short ReadHeaderTimeout to avoid Slowloris attacks, but doing so would expose us to Keep-Alive race conditions (see https://iximiuz.com/en/posts/reverse-proxy-http-keep-alive-and-502s/)
95-
- G112
96-
# created file permissions are restricted by umask if necessary
97-
- G306
98-
govet:
99-
enable-all: true
100-
disable:
101-
- fieldalignment
102-
nolintlint:
103-
require-specific: true
104-
stylecheck:
105-
dot-import-whitelist:
106-
- github.com/majewsky/gg/option
107-
- github.com/onsi/ginkgo/v2
108-
- github.com/onsi/gomega
109-
usestdlibvars:
110-
constant-kind: true
111-
crypto-hash: true
112-
default-rpc-path: true
113-
http-method: true
114-
http-status-code: true
115-
sql-isolation-level: true
116-
time-layout: true
117-
time-month: true
118-
time-weekday: true
119-
tls-signature-scheme: true
120-
usetesting:
121-
os-temp-dir: true
122-
whitespace:
123-
# Enforce newlines (or comments) after multi-line function signatures.
124-
multi-func: true
125-
12635
linters:
127-
# We use 'disable-all' and enable linters explicitly so that a newer version
128-
# does not introduce new linters unexpectedly.
129-
disable-all: true
36+
# Disable all pre-enabled linters and enable them explicitly so that a newer version does not introduce new linters unexpectedly
37+
default: none
13038
enable:
13139
- bodyclose
13240
- containedctx
@@ -142,11 +50,8 @@ linters:
14250
- gocheckcompilerdirectives
14351
- goconst
14452
- gocritic
145-
- gofmt
146-
- goimports
14753
- gomoddirectives
14854
- gosec
149-
- gosimple
15055
- govet
15156
- ineffassign
15257
- intrange
@@ -160,11 +65,126 @@ linters:
16065
- rowserrcheck
16166
- sqlclosecheck
16267
- staticcheck
163-
- stylecheck
164-
- typecheck
16568
- unconvert
16669
- unparam
16770
- unused
16871
- usestdlibvars
16972
- usetesting
17073
- whitespace
74+
settings:
75+
errcheck:
76+
check-type-assertions: false
77+
# Report about assignment of errors to blank identifier.
78+
check-blank: true
79+
# Do not report about not checking of errors in type assertions.
80+
# This is not as dangerous as skipping error values because an unchecked type assertion just immediately panics.
81+
# We disable this because it makes a ton of useless noise esp. in test code.
82+
forbidigo:
83+
analyze-types: true # required for pkg:
84+
forbid:
85+
# ioutil package has been deprecated: https://github.com/golang/go/issues/42026
86+
- pattern: ^ioutil\..*$
87+
# Using http.DefaultServeMux is discouraged because it's a global variable that some packages silently and magically add handlers to (esp. net/http/pprof).
88+
# Applications wishing to use http.ServeMux should obtain local instances through http.NewServeMux() instead of using the global default instance.
89+
- pattern: ^http\.DefaultServeMux$
90+
- pattern: ^http\.Handle(?:Func)?$
91+
- pkg: ^gopkg\.in/square/go-jose\.v2$
92+
msg: gopk.in/square/go-jose is archived and has CVEs. Replace it with gopkg.in/go-jose/go-jose.v2
93+
- pkg: ^github.com/coreos/go-oidc$
94+
msg: github.com/coreos/go-oidc depends on gopkg.in/square/go-jose which has CVEs. Replace it with github.com/coreos/go-oidc/v3
95+
- pkg: ^github.com/howeyc/gopass$
96+
msg: github.com/howeyc/gopass is archived, use golang.org/x/term instead
97+
goconst:
98+
min-occurrences: 5
99+
gocritic:
100+
enabled-checks:
101+
- boolExprSimplify
102+
- builtinShadow
103+
- emptyStringTest
104+
- evalOrder
105+
- httpNoBody
106+
- importShadow
107+
- initClause
108+
- methodExprCall
109+
- paramTypeCombine
110+
- preferFilepathJoin
111+
- ptrToRefParam
112+
- redundantSprint
113+
- returnAfterHttpError
114+
- stringConcatSimplify
115+
- timeExprSimplify
116+
- truncateCmp
117+
- typeAssertChain
118+
- typeUnparen
119+
- unnamedResult
120+
- unnecessaryBlock
121+
- unnecessaryDefer
122+
- weakCond
123+
- yodaStyleExpr
124+
gomoddirectives:
125+
replace-allow-list:
126+
# for go-pmtud
127+
- github.com/mdlayher/arp
128+
toolchain-forbidden: true
129+
go-version-pattern: 1\.\d+(\.0)?$
130+
gosec:
131+
excludes:
132+
# gosec wants us to set a short ReadHeaderTimeout to avoid Slowloris attacks, but doing so would expose us to Keep-Alive race conditions (see https://iximiuz.com/en/posts/reverse-proxy-http-keep-alive-and-502s/
133+
- G112
134+
# created file permissions are restricted by umask if necessary
135+
- G306
136+
govet:
137+
disable:
138+
- fieldalignment
139+
enable-all: true
140+
nolintlint:
141+
require-specific: true
142+
staticcheck:
143+
dot-import-whitelist:
144+
- github.com/majewsky/gg/option
145+
- github.com/onsi/ginkgo/v2
146+
- github.com/onsi/gomega
147+
usestdlibvars:
148+
http-method: true
149+
http-status-code: true
150+
time-weekday: true
151+
time-month: true
152+
time-layout: true
153+
crypto-hash: true
154+
default-rpc-path: true
155+
sql-isolation-level: true
156+
tls-signature-scheme: true
157+
constant-kind: true
158+
usetesting:
159+
os-temp-dir: true
160+
whitespace:
161+
# Enforce newlines (or comments) after multi-line function signatures.
162+
multi-func: true
163+
exclusions:
164+
generated: lax
165+
presets:
166+
- comments
167+
- common-false-positives
168+
- legacy
169+
- std-error-handling
170+
rules:
171+
- linters:
172+
- bodyclose
173+
path: _test\.go
174+
# It is idiomatic Go to reuse the name 'err' with ':=' for subsequent errors.
175+
# Ref: https://go.dev/doc/effective_go#redeclaration
176+
- path: (.+)\.go$
177+
text: declaration of "err" shadows declaration at
178+
- linters:
179+
- goconst
180+
path: (.+)_test\.go
181+
paths:
182+
- third_party$
183+
- builtin$
184+
- examples$
185+
186+
output:
187+
formats:
188+
text:
189+
# Do not print lines of code with issue.
190+
print-issued-lines: false

0 commit comments

Comments
 (0)