Skip to content

Commit a27acc6

Browse files
Upgrade go-makefile-maker (#90)
1 parent 171ee6f commit a27acc6

28 files changed

+237
-201
lines changed

.editorconfig

+26
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
check-latest: true
3232
go-version: 1.24.2
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

+133-123
Original file line numberDiff line numberDiff line change
@@ -1,150 +1,45 @@
1-
################################################################################
2-
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
3-
# Edit Makefile.maker.yaml instead. #
4-
################################################################################
5-
61
# Copyright 2024 SAP SE
72
# SPDX-License-Identifier: Apache-2.0
83

4+
version: "2"
95
run:
10-
timeout: 3m # 1m by default
116
modules-download-mode: readonly
7+
timeout: 3m0s # none by default in v2
128

13-
output:
14-
# Do not print lines of code with issue.
15-
print-issued-lines: false
9+
formatters:
10+
enable:
11+
- gofmt
12+
exclusions:
13+
generated: lax
14+
paths:
15+
- third_party$
16+
- builtin$
17+
- examples$
1618

1719
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-
- dupl
27-
# '0' disables the following options.
20+
# '0' disables the following options
2821
max-issues-per-linter: 0
2922
max-same-issues: 0
3023

31-
linters-settings:
32-
dupl:
33-
# Tokens count to trigger issue, 150 by default.
34-
threshold: 100
35-
errcheck:
36-
# Report about assignment of errors to blank identifier.
37-
check-blank: true
38-
# Do not report about not checking of errors in type assertions.
39-
# This is not as dangerous as skipping error values because an unchecked type assertion just immediately panics.
40-
# We disable this because it makes a ton of useless noise esp. in test code.
41-
check-type-assertions: false
42-
exclude-functions:
43-
- goimports
44-
forbidigo:
45-
analyze-types: true # required for pkg:
46-
forbid:
47-
# ioutil package has been deprecated: https://github.com/golang/go/issues/42026
48-
- ^ioutil\..*$
49-
# Using http.DefaultServeMux is discouraged because it's a global variable that some packages silently and magically add handlers to (esp. net/http/pprof).
50-
# Applications wishing to use http.ServeMux should obtain local instances through http.NewServeMux() instead of using the global default instance.
51-
- ^http\.DefaultServeMux$
52-
- ^http\.Handle(?:Func)?$
53-
# Forbid usage of old and archived square/go-jose
54-
- pkg: ^gopkg\.in/square/go-jose\.v2$
55-
msg: "gopk.in/square/go-jose is archived and has CVEs. Replace it with gopkg.in/go-jose/go-jose.v2"
56-
- pkg: ^github.com/coreos/go-oidc$
57-
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"
58-
59-
- pkg: ^github.com/howeyc/gopass$
60-
msg: "github.com/howeyc/gopass is archived, use golang.org/x/term instead"
61-
goconst:
62-
ignore-tests: true
63-
min-occurrences: 5
64-
gocritic:
65-
enabled-checks:
66-
- boolExprSimplify
67-
- builtinShadow
68-
- emptyStringTest
69-
- evalOrder
70-
- httpNoBody
71-
- importShadow
72-
- initClause
73-
- methodExprCall
74-
- paramTypeCombine
75-
- preferFilepathJoin
76-
- ptrToRefParam
77-
- redundantSprint
78-
- returnAfterHttpError
79-
- stringConcatSimplify
80-
- timeExprSimplify
81-
- truncateCmp
82-
- typeAssertChain
83-
- typeUnparen
84-
- unnamedResult
85-
- unnecessaryBlock
86-
- unnecessaryDefer
87-
- weakCond
88-
- yodaStyleExpr
89-
goimports:
90-
# Put local imports after 3rd-party packages.
91-
local-prefixes: github.com/cobaltcore-dev/cortex
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/onsi/ginkgo/v2
107-
- github.com/onsi/gomega
108-
usestdlibvars:
109-
constant-kind: true
110-
crypto-hash: true
111-
default-rpc-path: true
112-
http-method: true
113-
http-status-code: true
114-
sql-isolation-level: true
115-
time-layout: true
116-
time-month: true
117-
time-weekday: true
118-
tls-signature-scheme: true
119-
whitespace:
120-
# Enforce newlines (or comments) after multi-line function signatures.
121-
multi-func: true
122-
12324
linters:
124-
# We use 'disable-all' and enable linters explicitly so that a newer version
125-
# does not introduce new linters unexpectedly.
126-
disable-all: true
25+
# Disable all pre-enabled linters and enable them explicitly so that a newer version does not introduce new linters unexpectedly
26+
default: none
12727
enable:
12828
- bodyclose
12929
- containedctx
13030
- copyloopvar
131-
# Produces false positives with strings such as SQL queries.
132-
# - dupl
13331
- dupword
13432
- durationcheck
13533
- errcheck
13634
- errname
13735
- errorlint
36+
- exptostd
13837
- forbidigo
13938
- ginkgolinter
14039
- gocheckcompilerdirectives
14140
- goconst
14241
- gocritic
143-
- gofmt
144-
# Disabled for now - produces too many false positives
145-
# - goimports
14642
- gosec
147-
- gosimple
14843
- govet
14944
- ineffassign
15045
- intrange
@@ -158,11 +53,126 @@ linters:
15853
- rowserrcheck
15954
- sqlclosecheck
16055
- staticcheck
161-
- stylecheck
162-
- tenv
163-
- typecheck
16456
- unconvert
16557
- unparam
16658
- unused
16759
- usestdlibvars
60+
- usetesting
16861
- whitespace
62+
settings:
63+
errcheck:
64+
check-type-assertions: false
65+
# Report about assignment of errors to blank identifier.
66+
check-blank: true
67+
# Do not report about not checking of errors in type assertions.
68+
# This is not as dangerous as skipping error values because an unchecked type assertion just immediately panics.
69+
# We disable this because it makes a ton of useless noise esp. in test code.
70+
forbidigo:
71+
analyze-types: true # required for pkg:
72+
forbid:
73+
# ioutil package has been deprecated: https://github.com/golang/go/issues/42026
74+
- pattern: ^ioutil\..*$
75+
# Using http.DefaultServeMux is discouraged because it's a global variable that some packages silently and magically add handlers to (esp. net/http/pprof).
76+
# Applications wishing to use http.ServeMux should obtain local instances through http.NewServeMux() instead of using the global default instance.
77+
- pattern: ^http\.DefaultServeMux$
78+
- pattern: ^http\.Handle(?:Func)?$
79+
- pkg: ^gopkg\.in/square/go-jose\.v2$
80+
msg: gopk.in/square/go-jose is archived and has CVEs. Replace it with gopkg.in/go-jose/go-jose.v2
81+
- pkg: ^github.com/coreos/go-oidc$
82+
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
83+
- pkg: ^github.com/howeyc/gopass$
84+
msg: github.com/howeyc/gopass is archived, use golang.org/x/term instead
85+
goconst:
86+
min-occurrences: 5
87+
gocritic:
88+
enabled-checks:
89+
- boolExprSimplify
90+
- builtinShadow
91+
- emptyStringTest
92+
- evalOrder
93+
- httpNoBody
94+
- importShadow
95+
- initClause
96+
- methodExprCall
97+
- paramTypeCombine
98+
- preferFilepathJoin
99+
- ptrToRefParam
100+
- redundantSprint
101+
- returnAfterHttpError
102+
- stringConcatSimplify
103+
- timeExprSimplify
104+
- truncateCmp
105+
- typeAssertChain
106+
- typeUnparen
107+
- unnamedResult
108+
- unnecessaryBlock
109+
- unnecessaryDefer
110+
- weakCond
111+
- yodaStyleExpr
112+
gomoddirectives:
113+
replace-allow-list:
114+
# for go-pmtud
115+
- github.com/mdlayher/arp
116+
toolchain-forbidden: true
117+
go-version-pattern: 1\.\d+(\.0)?$
118+
gosec:
119+
excludes:
120+
# 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/
121+
- G112
122+
# created file permissions are restricted by umask if necessary
123+
- G306
124+
govet:
125+
disable:
126+
- fieldalignment
127+
enable-all: true
128+
nolintlint:
129+
require-specific: true
130+
staticcheck:
131+
dot-import-whitelist:
132+
- github.com/majewsky/gg/option
133+
- github.com/onsi/ginkgo/v2
134+
- github.com/onsi/gomega
135+
usestdlibvars:
136+
http-method: true
137+
http-status-code: true
138+
time-weekday: true
139+
time-month: true
140+
time-layout: true
141+
crypto-hash: true
142+
default-rpc-path: true
143+
sql-isolation-level: true
144+
tls-signature-scheme: true
145+
constant-kind: true
146+
usetesting:
147+
os-temp-dir: true
148+
whitespace:
149+
# Enforce newlines (or comments) after multi-line function signatures.
150+
multi-func: true
151+
exclusions:
152+
generated: lax
153+
presets:
154+
- comments
155+
- common-false-positives
156+
- legacy
157+
- std-error-handling
158+
rules:
159+
- linters:
160+
- bodyclose
161+
path: _test\.go
162+
# It is idiomatic Go to reuse the name 'err' with ':=' for subsequent errors.
163+
# Ref: https://go.dev/doc/effective_go#redeclaration
164+
- path: (.+)\.go$
165+
text: declaration of "err" shadows declaration at
166+
- linters:
167+
- goconst
168+
path: (.+)_test\.go
169+
paths:
170+
- third_party$
171+
- builtin$
172+
- examples$
173+
174+
output:
175+
formats:
176+
text:
177+
# Do not print lines of code with issue.
178+
print-issued-lines: false

.license-scan-overrides.jsonl

+2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{"name": "github.com/chzyer/logex", "licenceType": "MIT"}
22
{"name": "github.com/hashicorp/vault/api/auth/approle", "licenceType": "MPL-2.0"}
33
{"name": "github.com/jpillora/longestcommon", "licenceType": "MIT"}
4+
{"name": "github.com/mattn/go-localereader", "licenceType": "MIT"}
45
{"name": "github.com/miekg/dns", "licenceType": "BSD-3-Clause"}
56
{"name": "github.com/spdx/tools-golang", "licenceTextOverrideFile": "vendor/github.com/spdx/tools-golang/LICENSE.code"}
67
{"name": "github.com/xeipuuv/gojsonpointer", "licenceType": "Apache-2.0"}
78
{"name": "github.com/xeipuuv/gojsonreference", "licenceType": "Apache-2.0"}
89
{"name": "github.com/xeipuuv/gojsonschema", "licenceType": "Apache-2.0"}
10+
{"name": "github.wdf.sap.corp/cc/nxos-gnmi-go", "licenceType": "Apache-2.0"}

.license-scan-rules.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"BSD-2-Clause",
55
"BSD-2-Clause-FreeBSD",
66
"BSD-3-Clause",
7+
"EPL-2.0",
78
"ISC",
89
"MIT",
910
"MPL-2.0",
1011
"Unlicense",
11-
"Zlib",
12-
"EPL-2.0"
12+
"Zlib"
1313
]
1414
}

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2025 SAP SE
22
# SPDX-License-Identifier: Apache-2.0
33

4-
FROM golang:1.24.1-alpine3.21 AS builder
4+
FROM golang:1.24.2-alpine3.21 AS builder
55

66
RUN apk add --no-cache --no-progress ca-certificates gcc git make musl-dev
77

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ install-goimports: FORCE
2323
@if ! hash goimports 2>/dev/null; then printf "\e[1;36m>> Installing goimports (this may take a while)...\e[0m\n"; go install golang.org/x/tools/cmd/goimports@latest; fi
2424

2525
install-golangci-lint: FORCE
26-
@if ! hash golangci-lint 2>/dev/null; then printf "\e[1;36m>> Installing golangci-lint (this may take a while)...\e[0m\n"; go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest; fi
26+
@if ! hash golangci-lint 2>/dev/null; then printf "\e[1;36m>> Installing golangci-lint (this may take a while)...\e[0m\n"; go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest; fi
2727

2828
install-go-licence-detector: FORCE
2929
@if ! hash go-licence-detector 2>/dev/null; then printf "\e[1;36m>> Installing go-licence-detector (this may take a while)...\e[0m\n"; go install go.elastic.co/go-licence-detector@latest; fi
@@ -77,6 +77,7 @@ check: FORCE static-check build/cover.html build-all
7777

7878
run-golangci-lint: FORCE install-golangci-lint
7979
@printf "\e[1;36m>> golangci-lint\e[0m\n"
80+
@golangci-lint config verify
8081
@golangci-lint run
8182

8283
build/cover.out: FORCE | build

0 commit comments

Comments
 (0)