Skip to content

Commit a18bbf1

Browse files
authored
Merge pull request #190 from flavio/dependabot/github_actions/actions/setup-go-5.4.0
chore(deps): Bump actions/setup-go from 5.3.0 to 5.4.0
2 parents d7d3425 + 68eeece commit a18bbf1

File tree

6 files changed

+98
-45
lines changed

6 files changed

+98
-45
lines changed

.github/workflows/ci.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ jobs:
2222

2323
steps:
2424
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25-
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
25+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
2626
with:
27-
go-version: "1.23.x"
27+
go-version: "1.24.x"
2828
- run: go test ./...
2929

3030
golangci:
3131
name: Golangci-lint
3232
runs-on: ubuntu-latest
3333
steps:
3434
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35-
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
35+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
3636
with:
37-
go-version: "1.23.x"
37+
go-version: "1.24.x"
3838
- name: golangci-lint
3939
uses: golangci/golangci-lint-action@4696ba8babb6127d732c3c6dde519db15edab9ea # v6.5.1
4040
with:
41-
version: v1.62.2
41+
version: v1.64.7

.github/workflows/release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
with:
2222
fetch-depth: 0
2323
- name: Set up Go
24-
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
24+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
2525
with:
26-
go-version: 1.23.x
26+
go-version: 1.24.x
2727
- uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
2828
- name: Run GoReleaser
2929
uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1

.golangci.yml

+88-33
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
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.60.3
4+
## Golden config for golangci-lint v1.64.7
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
# This file contains only configs which differ from defaults.
16-
# All possible options can be found here https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml
29+
# All possible options can be found here https://github.com/golangci/golangci-lint/blob/HEAD/.golangci.reference.yml
1730
linters-settings:
1831
cyclop:
1932
# The maximal code complexity to report.
@@ -24,6 +37,51 @@ linters-settings:
2437
# Default: 0.0
2538
package-average: 10.0
2639

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

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

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

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

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

211262
linters:
212263
disable-all: true
@@ -227,11 +278,13 @@ linters:
227278
- canonicalheader # checks whether net/http.Header uses canonical header
228279
- copyloopvar # detects places where loop variables are copied (Go 1.22+)
229280
- cyclop # checks function and package cyclomatic complexity
281+
- depguard # checks if package imports are in a list of acceptable packages
230282
- dupl # tool for code clone detection
231283
- durationcheck # checks for two durations multiplied together
232284
- errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error
233285
- errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13
234286
- exhaustive # checks exhaustiveness of enum switch statements
287+
- exptostd # detects functions from golang.org/x/exp/ that can be replaced by std functions
235288
- fatcontext # detects nested contexts in loops
236289
- forbidigo # forbids identifiers
237290
- funlen # tool for detection of long functions
@@ -246,9 +299,9 @@ linters:
246299
- godot # checks if comments end in a period
247300
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt
248301
- gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
249-
- 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
250302
- goprintffuncname # checks that printf-like functions are named with f at the end
251303
- gosec # inspects source code for security problems
304+
- iface # checks the incorrect use of interfaces, helping developers avoid interface pollution
252305
- intrange # finds places where for loops could make use of an integer range
253306
- lll # reports long lines
254307
- loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap)
@@ -259,6 +312,7 @@ linters:
259312
- nakedret # finds naked returns in functions greater than a specified function length
260313
- nestif # reports deeply nested if statements
261314
- nilerr # finds the code that returns nil even if it checks that the error is not nil
315+
- nilnesserr # reports that it checks for err != nil, but it returns a different nil value error (powered by nilness and nilerr)
262316
- nilnil # checks that there is no simultaneous return of nil error and an invalid value
263317
- noctx # finds sending http request without context.Context
264318
- nolintlint # reports ill-formed or insufficient nolint directives
@@ -269,19 +323,20 @@ linters:
269323
- promlinter # checks Prometheus metrics naming via promlint
270324
- protogetter # reports direct reads from proto message fields when getters should be used
271325
- reassign # checks that package variables are not reassigned
326+
- recvcheck # checks for receiver type consistency
272327
- revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint
273328
- rowserrcheck # checks whether Err of rows is checked successfully
274329
- sloglint # ensure consistent code style when using log/slog
275330
- spancheck # checks for mistakes with OpenTelemetry/Census spans
276331
- sqlclosecheck # checks that sql.Rows and sql.Stmt are closed
277332
- stylecheck # is a replacement for golint
278-
- tenv # detects using os.Setenv instead of t.Setenv since Go1.17
279333
- testableexamples # checks if examples are testable (have an expected output)
280334
- testifylint # checks usage of github.com/stretchr/testify
281335
- tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes
282336
- unconvert # removes unnecessary type conversions
283337
- unparam # reports unused function parameters
284338
- usestdlibvars # detects the possibility to use variables/constants from the Go standard library
339+
- usetesting # reports uses of functions with replacement inside the testing package
285340
- wastedassign # finds wasted assignment statements
286341
- whitespace # detects leading and trailing whitespace
287342

@@ -290,7 +345,7 @@ linters:
290345
#- exhaustruct # [highly recommend to enable] checks if all structure fields are initialized
291346
#- gci # controls golang package import order and makes it always deterministic
292347
#- ginkgolinter # [if you use ginkgo/gomega] enforces standards of using ginkgo and gomega
293-
#- godox # detects FIXME, TODO and other comment keywords
348+
#- godox # detects usage of FIXME, TODO and other keywords inside comments
294349
#- goheader # checks is file header matches to pattern
295350
#- inamedparam # [great idea, but too strict, need to ignore a lot of cases by default] reports interfaces with unnamed method parameters
296351
#- interfacebloat # checks the number of methods inside an interface
@@ -304,16 +359,14 @@ linters:
304359
## disabled
305360
#- containedctx # detects struct contained context.Context field
306361
#- contextcheck # [too many false positives] checks the function whether use a non-inherited context
307-
#- depguard # [replaced by gomodguard] checks if package imports are in a list of acceptable packages
308362
#- dogsled # checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
309363
#- dupword # [useless without config] checks for duplicate words in the source code
310364
#- err113 # [too strict] checks the errors handling expressions
311365
#- 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
312-
#- execinquery # [deprecated] checks query string in Query function which reads your Go src files and warning it finds
313-
#- exportloopref # [not necessary from Go 1.22] checks for pointers to enclosing loop variables
314366
#- forcetypeassert # [replaced by errcheck] finds forced type assertions
315367
#- gofmt # [replaced by goimports] checks whether code was gofmt-ed
316368
#- gofumpt # [replaced by goimports, gofumports is not available yet] checks whether code was gofumpt-ed
369+
#- gomodguard # [use more powerful depguard] allow and block lists linter for direct Go module dependencies
317370
#- gosmopolitan # reports certain i18n/l10n anti-patterns in your Go codebase
318371
#- grouper # analyzes expression groups
319372
#- importas # enforces consistent import aliases
@@ -322,6 +375,7 @@ linters:
322375
#- nlreturn # [too strict and mostly code is not more readable] checks for a new line before return and branch statements to increase code clarity
323376
#- paralleltest # [too many false positives] detects missing usage of t.Parallel() method in your Go test
324377
#- tagliatelle # checks the struct tags
378+
#- tenv # [deprecated, replaced by usetesting] detects using os.Setenv instead of t.Setenv since Go1.17
325379
#- thelper # detects golang test helpers without t.Helper() call and checks the consistency of test helpers
326380
#- wsl # [too strict and mostly code is not more readable] whitespace linter forces you to use empty lines
327381

@@ -340,6 +394,7 @@ issues:
340394
linters:
341395
- bodyclose
342396
- dupl
397+
- errcheck
343398
- funlen
344399
- goconst
345400
- gosec

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ GO_VERSION_MAJ := $(shell echo $(GO_VERSION) | cut -f1 -d'.')
1414
GO_VERSION_MIN := $(shell echo $(GO_VERSION) | cut -f2 -d'.')
1515

1616
# golangci linter
17-
GOLANGCI_LINT_VERSION := v1.62.2
17+
GOLANGCI_LINT_VERSION := v1.64.7
1818
GOLANGCI_LINT ?= go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
1919

2020
GOFMT ?= gofmt

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/flavio/kuberlr
22

3-
go 1.23.0
3+
go 1.24.0
44

55
toolchain go1.24.1
66

internal/finder/versioner_test.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package finder
33
import (
44
"fmt"
55
"math/rand"
6-
"os"
76
"testing"
87

98
"github.com/flavio/kuberlr/internal/common"
@@ -201,8 +200,7 @@ func TestKubectlVersionToUseSetsInfiniteRecursionPrevention(t *testing.T) {
201200
t.Run(tt.name, func(t *testing.T) {
202201
preventRecursiveInvocationEnvName := fmt.Sprintf("KUBERLR_RESOLVING_VERSION_%d", rand.Intn(100))
203202
if tt.recursionHappening {
204-
os.Setenv(preventRecursiveInvocationEnvName, "1")
205-
defer os.Unsetenv(preventRecursiveInvocationEnvName)
203+
t.Setenv(preventRecursiveInvocationEnvName, "1")
206204
}
207205

208206
expectedVersion := tt.expectedVersion

0 commit comments

Comments
 (0)