Skip to content

Commit 18431d9

Browse files
authored
Merge pull request #92 from kubewarden/renovate/all-minor-patch
chore(deps): update all non-major dependencies
2 parents 8dd8ce5 + 1f97d4e commit 18431d9

File tree

6 files changed

+97
-60
lines changed

6 files changed

+97
-60
lines changed

.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ name: Release policy
1010
jobs:
1111
test:
1212
name: run tests and linters
13-
uses: kubewarden/github-actions/.github/workflows/[email protected].6
13+
uses: kubewarden/github-actions/.github/workflows/[email protected].8
1414

1515
release:
1616
needs: test
@@ -22,6 +22,6 @@ jobs:
2222
# Required by cosign keyless signing
2323
id-token: write
2424

25-
uses: kubewarden/github-actions/.github/workflows/[email protected].6
25+
uses: kubewarden/github-actions/.github/workflows/[email protected].8
2626
with:
2727
oci-target: ghcr.io/${{ github.repository_owner }}/policies/policy-name #FIXME

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ name: Continuous integration
33
jobs:
44
test:
55
name: run tests and linters
6-
uses: kubewarden/github-actions/.github/workflows/[email protected].6
6+
uses: kubewarden/github-actions/.github/workflows/[email protected].8

.golangci.yml

+89-44
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
1-
# This code is licensed under the terms of the MIT license https://opensource.org/license/mit
2-
# Copyright (c) 2021 Marat Reymers
1+
# This file is licensed under the terms of the MIT license https://opensource.org/license/mit
2+
# Copyright (c) 2021-2025 Marat Reymers
33

4-
## Golden config for golangci-lint v1.59.1
4+
## Golden config for golangci-lint v1.64.6
55
#
66
# This is the best config for golangci-lint based on my experience and opinion.
77
# It is very strict, but not extremely strict.
8-
# Feel free to adapt and change it for your needs.
8+
# Feel free to adapt it to suit your needs.
9+
# If this config helps you, please consider keeping a link to this file (see the next comment).
10+
11+
# Based on https://gist.github.com/maratori/47a4d00457a92aa426dbd48a18776322
912

1013
run:
1114
# Timeout for analysis, e.g. 30s, 5m.
1215
# Default: 1m
1316
timeout: 3m
1417

18+
# The mode used to evaluate relative paths.
19+
# It's used by exclusions, Go plugins, and some linters.
20+
# The value can be:
21+
# - `gomod`: the paths will be relative to the directory of the `go.mod` file.
22+
# - `gitroot`: the paths will be relative to the git root (the parent directory of `.git`).
23+
# - `cfg`: the paths will be relative to the configuration file.
24+
# - `wd` (NOT recommended): the paths will be relative to the place where golangci-lint is run.
25+
# Default: wd
26+
relative-path-mode: gomod
27+
1528

1629
# This file contains only configs which differ from defaults.
17-
# All possible options can be found here https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml
30+
# All possible options can be found here https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.reference.yml
1831
linters-settings:
1932
cyclop:
2033
# The maximal code complexity to report.
@@ -25,6 +38,51 @@ linters-settings:
2538
# Default: 0.0
2639
package-average: 10.0
2740

41+
depguard:
42+
# Rules to apply.
43+
#
44+
# Variables:
45+
# - File Variables
46+
# Use an exclamation mark `!` to negate a variable.
47+
# Example: `!$test` matches any file that is not a go test file.
48+
#
49+
# `$all` - matches all go files
50+
# `$test` - matches all go test files
51+
#
52+
# - Package Variables
53+
#
54+
# `$gostd` - matches all of go's standard library (Pulled from `GOROOT`)
55+
#
56+
# Default (applies if no custom rules are defined): Only allow $gostd in all files.
57+
rules:
58+
"deprecated":
59+
# List of file globs that will match this list of settings to compare against.
60+
# Default: $all
61+
files:
62+
- "$all"
63+
# List of packages that are not allowed.
64+
# Entries can be a variable (starting with $), a string prefix, or an exact match (if ending with $).
65+
# Default: []
66+
deny:
67+
- pkg: "github.com/golang/protobuf"
68+
desc: "Use google.golang.org/protobuf instead, see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules"
69+
- pkg: "github.com/satori/go.uuid"
70+
desc: "Use github.com/google/uuid instead, satori's package is not maintained"
71+
- pkg: "github.com/gofrs/uuid$"
72+
desc: "Use github.com/gofrs/uuid/v5 or later, it was not a go module before v5"
73+
"non-test files":
74+
files:
75+
- "!$test"
76+
deny:
77+
- pkg: "math/rand$"
78+
desc: "Use math/rand/v2 instead, see https://go.dev/blog/randv2"
79+
"non-main files":
80+
files:
81+
- "!**/main.go"
82+
deny:
83+
- pkg: "log$"
84+
desc: "Use log/slog instead, see https://go.dev/blog/slog"
85+
2886
errcheck:
2987
# Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
3088
# Such cases aren't reported by default.
@@ -80,6 +138,11 @@ linters-settings:
80138
# Default false
81139
ignore-comments: true
82140

141+
gochecksumtype:
142+
# Presence of `default` case in switch statements satisfies exhaustiveness, if all members are not listed.
143+
# Default: true
144+
default-signifies-exhaustive: false
145+
83146
gocognit:
84147
# Minimal code complexity to report.
85148
# Default: 30 (but we recommend 10-20)
@@ -99,24 +162,6 @@ linters-settings:
99162
# Default: true
100163
skipRecvDeref: false
101164

102-
gomodguard:
103-
blocked:
104-
# List of blocked modules.
105-
# Default: []
106-
modules:
107-
- github.com/golang/protobuf:
108-
recommendations:
109-
- google.golang.org/protobuf
110-
reason: "see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules"
111-
- github.com/satori/go.uuid:
112-
recommendations:
113-
- github.com/google/uuid
114-
reason: "satori's package is not maintained"
115-
- github.com/gofrs/uuid:
116-
recommendations:
117-
- github.com/gofrs/uuid/v5
118-
reason: "gofrs' package was not go module before v5"
119-
120165
govet:
121166
# Enable all analyzers.
122167
# Default: false
@@ -179,6 +224,13 @@ linters-settings:
179224
# Default: true
180225
strconcat: false
181226

227+
reassign:
228+
# Patterns for global variable names that are checked for reassignment.
229+
# See https://github.com/curioswitch/go-reassign#usage
230+
# Default: ["EOF", "Err.*"]
231+
patterns:
232+
- ".*"
233+
182234
rowserrcheck:
183235
# database/sql is always checked
184236
# Default: []
@@ -203,11 +255,10 @@ linters-settings:
203255
# Default: ""
204256
context: "scope"
205257

206-
tenv:
207-
# The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures.
208-
# Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked.
258+
usetesting:
259+
# Enable/disable `os.TempDir()` detections.
209260
# Default: false
210-
all: true
261+
os-temp-dir: true
211262

212263

213264
linters:
@@ -227,14 +278,15 @@ linters:
227278
- bidichk # checks for dangerous unicode character sequences
228279
- bodyclose # checks whether HTTP response body is closed successfully
229280
- canonicalheader # checks whether net/http.Header uses canonical header
230-
- copyloopvar # detects places where loop variables are copied
281+
- copyloopvar # detects places where loop variables are copied (Go 1.22+)
231282
- cyclop # checks function and package cyclomatic complexity
283+
- depguard # checks if package imports are in a list of acceptable packages
232284
- dupl # tool for code clone detection
233285
- durationcheck # checks for two durations multiplied together
234286
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
235287
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
236288
- exhaustive # checks exhaustiveness of enum switch statements
237-
- exportloopref # checks for pointers to enclosing loop variables
289+
- exptostd # detects functions from golang.org/x/exp/ that can be replaced by std functions
238290
- fatcontext # detects nested contexts in loops
239291
- forbidigo # forbids identifiers
240292
- funlen # tool for detection of long functions
@@ -248,9 +300,9 @@ linters:
248300
- gocyclo # computes and checks the cyclomatic complexity of functions
249301
- godot # checks if comments end in a period
250302
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt
251-
- gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations
252303
- goprintffuncname # checks that printf-like functions are named with f at the end
253304
- gosec # inspects source code for security problems
305+
- iface # checks the incorrect use of interfaces, helping developers avoid interface pollution
254306
- intrange # finds places where for loops could make use of an integer range
255307
- lll # reports long lines
256308
- loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap)
@@ -261,6 +313,7 @@ linters:
261313
- nakedret # finds naked returns in functions greater than a specified function length
262314
- nestif # reports deeply nested if statements
263315
- nilerr # finds the code that returns nil even if it checks that the error is not nil
316+
- nilnesserr # reports that it checks for err != nil, but it returns a different nil value error (powered by nilness and nilerr)
264317
- nilnil # checks that there is no simultaneous return of nil error and an invalid value
265318
- noctx # finds sending http request without context.Context
266319
- nolintlint # reports ill-formed or insufficient nolint directives
@@ -271,20 +324,21 @@ linters:
271324
- promlinter # checks Prometheus metrics naming via promlint
272325
- protogetter # reports direct reads from proto message fields when getters should be used
273326
- reassign # checks that package variables are not reassigned
327+
- recvcheck # checks for receiver type consistency
274328
- revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
275329
- rowserrcheck # checks whether Err of rows is checked successfully
276330
- sloglint # ensure consistent code style when using log/slog
277331
- spancheck # checks for mistakes with OpenTelemetry/Census spans
278332
- sqlclosecheck # checks that sql.Rows and sql.Stmt are closed
279333
- stylecheck # is a replacement for golint
280-
- tenv # detects using os.Setenv instead of t.Setenv since Go1.17
281334
- testableexamples # checks if examples are testable (have an expected output)
282335
- testifylint # checks usage of github.com/stretchr/testify
283336
- testpackage # makes you use a separate _test package
284337
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
285338
- unconvert # removes unnecessary type conversions
286339
- unparam # reports unused function parameters
287340
- usestdlibvars # detects the possibility to use variables/constants from the Go standard library
341+
- usetesting # reports uses of functions with replacement inside the testing package
288342
- wastedassign # finds wasted assignment statements
289343
- whitespace # detects leading and trailing whitespace
290344

@@ -293,7 +347,7 @@ linters:
293347
#- exhaustruct # [highly recommend to enable] checks if all structure fields are initialized
294348
#- gci # controls golang package import order and makes it always deterministic
295349
#- ginkgolinter # [if you use ginkgo/gomega] enforces standards of using ginkgo and gomega
296-
#- godox # detects FIXME, TODO and other comment keywords
350+
#- godox # detects usage of FIXME, TODO and other keywords inside comments
297351
#- goheader # checks is file header matches to pattern
298352
#- inamedparam # [great idea, but too strict, need to ignore a lot of cases by default] reports interfaces with unnamed method parameters
299353
#- interfacebloat # checks the number of methods inside an interface
@@ -307,15 +361,14 @@ linters:
307361
## disabled
308362
#- containedctx # detects struct contained context.Context field
309363
#- contextcheck # [too many false positives] checks the function whether use a non-inherited context
310-
#- depguard # [replaced by gomodguard] checks if package imports are in a list of acceptable packages
311364
#- dogsled # checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
312365
#- dupword # [useless without config] checks for duplicate words in the source code
313366
#- err113 # [too strict] checks the errors handling expressions
314367
#- errchkjson # [don't see profit + I'm against of omitting errors like in the first example https://github.com/breml/errchkjson] checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted
315-
#- execinquery # [deprecated] checks query string in Query function which reads your Go src files and warning it finds
316368
#- forcetypeassert # [replaced by errcheck] finds forced type assertions
317369
#- gofmt # [replaced by goimports] checks whether code was gofmt-ed
318370
#- gofumpt # [replaced by goimports, gofumports is not available yet] checks whether code was gofumpt-ed
371+
#- gomodguard # [use more powerful depguard] allow and block lists linter for direct Go module dependencies
319372
#- gosmopolitan # reports certain i18n/l10n anti-patterns in your Go codebase
320373
#- grouper # analyzes expression groups
321374
#- importas # enforces consistent import aliases
@@ -324,20 +377,11 @@ linters:
324377
#- nlreturn # [too strict and mostly code is not more readable] checks for a new line before return and branch statements to increase code clarity
325378
#- paralleltest # [too many false positives] detects missing usage of t.Parallel() method in your Go test
326379
#- tagliatelle # checks the struct tags
380+
#- tenv # [deprecated, replaced by usetesting] detects using os.Setenv instead of t.Setenv since Go1.17
327381
#- thelper # detects golang test helpers without t.Helper() call and checks the consistency of test helpers
328382
#- wsl # [too strict and mostly code is not more readable] whitespace linter forces you to use empty lines
329-
330383

331-
############################################################################
332-
# Kubewarden linter customization
333-
# The following linters are disabled because they does not make sense for
334-
# the Kubewarden
335-
############################################################################
336384

337-
# We use replace directives in go.mod to replace some dependencies to use
338-
# our forked version.
339-
# - gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
340-
341385
issues:
342386
# Maximum count of issues with the same text.
343387
# Set to 0 to disable.
@@ -353,6 +397,7 @@ issues:
353397
linters:
354398
- bodyclose
355399
- dupl
400+
- errcheck
356401
- funlen
357402
- goconst
358403
- gosec

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ SOURCE_FILES := $(shell find . -type f -name '*.go')
66
# starting with v.
77
VERSION ?= $(shell git describe | cut -c2-)
88

9-
GOLANGCI_LINT_VER := v1.59.1
9+
GOLANGCI_LINT_VER := v1.64.6
1010
GOLANGCI_LINT_BIN := golangci-lint
1111
GOLANGCI_LINT := $(BIN_DIR)/$(GOLANGCI_LINT_BIN)
1212

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module github.com/kubewarden/go-policy-template
22

33
go 1.22
44

5-
toolchain go1.23.6
5+
toolchain go1.24.1
66

77
require (
88
github.com/francoispqt/onelog v0.0.0-20190306043706-8c2bb31b10a4

go.sum

+3-11
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,16 @@ github.com/francoispqt/onelog v0.0.0-20190306043706-8c2bb31b10a4 h1:N9eG+1y9e3tn
66
github.com/francoispqt/onelog v0.0.0-20190306043706-8c2bb31b10a4/go.mod h1:v1Il1fkBpjiYPpEJcGxqgrPUPcHuTC7eHh9zBV3CLBE=
77
github.com/kubewarden/k8s-objects v1.29.0-kw1 h1:bVQ2WL1ROqApYmHQJ/yxrs3tssfzzalblE2txChcHxY=
88
github.com/kubewarden/k8s-objects v1.29.0-kw1/go.mod h1:EMF+Hr26oDR4yQkWJAQpl0M0Ek5ioNXlCswjGZO0G2U=
9-
github.com/kubewarden/policy-sdk-go v0.6.0 h1:f7RL+hkcjt1g5/4JmUU+itzsdMNs5rFJT7ISJtSAB9g=
10-
github.com/kubewarden/policy-sdk-go v0.6.0/go.mod h1:C8sUX4FYhbP69cvQfPLmIvAJhVHQyg1qaq9EynOn8a0=
11-
github.com/kubewarden/policy-sdk-go v0.7.0 h1:quNOrqtZRgLHpknoIWl0yDWDK8xJ/hDtP8M40HVDPmc=
12-
github.com/kubewarden/policy-sdk-go v0.7.0/go.mod h1:wq/jwnVOpSaETu/n9DW0ePbeoUdoqYTEzlNKmZGaPIM=
13-
github.com/kubewarden/policy-sdk-go v0.8.0 h1:4SR6UeKLBQ+UkwohuMqYw2lPKgqgF5Ifdw7tFNjQwiI=
14-
github.com/kubewarden/policy-sdk-go v0.8.0/go.mod h1:gjYdcErABXti/dxoNW2PceSwy4+/X+o/wuLwWHZCoNU=
15-
github.com/kubewarden/policy-sdk-go v0.9.0 h1:tS9aMtjkUj04WJ0xjO3o0jSGvtj/T8rGr4mn3DPx5Fo=
16-
github.com/kubewarden/policy-sdk-go v0.9.0/go.mod h1:4Yg/Wpxnt7p4Ps68hBfnK8qoGURM5MJaq67Kjao2smY=
17-
github.com/kubewarden/policy-sdk-go v0.9.1 h1:ogO4Eq6/HEiVk0gnX+RNxFV71ICpf56kHjSqVjGtCDE=
18-
github.com/kubewarden/policy-sdk-go v0.9.1/go.mod h1:4Yg/Wpxnt7p4Ps68hBfnK8qoGURM5MJaq67Kjao2smY=
199
github.com/kubewarden/policy-sdk-go v0.11.0 h1:qW2UqARixH2r8KyitSistiAg0Ex0LA+HJr/xaBwiDcg=
2010
github.com/kubewarden/policy-sdk-go v0.11.0/go.mod h1:4Yg/Wpxnt7p4Ps68hBfnK8qoGURM5MJaq67Kjao2smY=
2111
github.com/kubewarden/strfmt v0.1.3 h1:bb+2rbotioROjCkziSt+hqnHXzOlumN94NxDKdV2kPI=
2212
github.com/kubewarden/strfmt v0.1.3/go.mod h1:DXoaaIYwqW1LyyRoMeyxfHUU+VUSTNFdj38juCXfRzs=
2313
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
2414
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
2515
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
26-
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
16+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
17+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
2718
github.com/wapc/wapc-guest-tinygo v0.3.3 h1:jLebiwjVSHLGnS+BRabQ6+XOV7oihVWAc05Hf1SbeR0=
2819
github.com/wapc/wapc-guest-tinygo v0.3.3/go.mod h1:mzM3CnsdSYktfPkaBdZ8v88ZlfUDEy5Jh5XBOV3fYcw=
2920
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
21+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)