Skip to content

Commit 0ae8e4f

Browse files
committed
[dev-v3] Bump Go v1.25, golangci-lint v2
Signed-off-by: George Jenkins <gvjenkins@gmail.com>
1 parent b49daa1 commit 0ae8e4f

File tree

15 files changed

+77
-77
lines changed

15 files changed

+77
-77
lines changed

.github/env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
GOLANG_VERSION=1.24
2-
GOLANGCI_LINT_VERSION=v1.64
1+
GOLANG_VERSION=1.25
2+
GOLANGCI_LINT_VERSION=v2.5.0

.golangci.yml

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,66 @@
1-
run:
2-
timeout: 10m
3-
1+
version: "2"
42
linters:
5-
disable-all: true
3+
default: none
64
enable:
75
- dupl
8-
- gofmt
9-
- goimports
10-
- gosimple
116
- govet
127
- ineffassign
138
- misspell
149
- nakedret
1510
- revive
16-
- unused
1711
- staticcheck
18-
19-
linters-settings:
20-
gofmt:
21-
simplify: true
22-
goimports:
23-
local-prefixes: helm.sh/helm/v3
24-
dupl:
25-
threshold: 400
26-
issues:
27-
exclude-rules:
28-
# Helm, and the Go source code itself, sometimes uses these names outside their built-in
29-
# functions. As the Go source code has re-used these names it's ok for Helm to do the same.
30-
# Linting will look for redefinition of built-in id's but we opt-in to the ones we choose to use.
31-
- linters:
32-
- revive
33-
text: "redefines-builtin-id: redefinition of the built-in function append"
34-
- linters:
35-
- revive
36-
text: "redefines-builtin-id: redefinition of the built-in function clear"
37-
- linters:
38-
- revive
39-
text: "redefines-builtin-id: redefinition of the built-in function max"
40-
- linters:
41-
- revive
42-
text: "redefines-builtin-id: redefinition of the built-in function min"
43-
- linters:
44-
- revive
45-
text: "redefines-builtin-id: redefinition of the built-in function new"
12+
- unused
13+
settings:
14+
dupl:
15+
threshold: 400
16+
staticcheck:
17+
checks:
18+
- "all"
19+
- "-QF1008" # QF1008: could remove embedded field "Foo" from selector
20+
- "-QF1001" # QF1001: could apply De Morgan's law
21+
exclusions:
22+
generated: lax
23+
presets:
24+
- comments
25+
- common-false-positives
26+
- legacy
27+
- std-error-handling
28+
rules:
29+
# Helm, and the Go source code itself, sometimes uses these names outside their built-in
30+
# functions. As the Go source code has re-used these names it's ok for Helm to do the same.
31+
# Linting will look for redefinition of built-in id's but we opt-in to the ones we choose to use.
32+
- linters:
33+
- revive
34+
text: 'redefines-builtin-id: redefinition of the built-in function append'
35+
- linters:
36+
- revive
37+
text: 'redefines-builtin-id: redefinition of the built-in function clear'
38+
- linters:
39+
- revive
40+
text: 'redefines-builtin-id: redefinition of the built-in function max'
41+
- linters:
42+
- revive
43+
text: 'redefines-builtin-id: redefinition of the built-in function min'
44+
- linters:
45+
- revive
46+
text: 'redefines-builtin-id: redefinition of the built-in function new'
47+
paths:
48+
- third_party$
49+
- builtin$
50+
- examples$
51+
formatters:
52+
enable:
53+
- gofmt
54+
- goimports
55+
settings:
56+
gofmt:
57+
simplify: true
58+
goimports:
59+
local-prefixes:
60+
- helm.sh/helm/v3
61+
exclusions:
62+
generated: lax
63+
paths:
64+
- third_party$
65+
- builtin$
66+
- examples$

cmd/helm/docs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (o *docsOptions) run(_ io.Writer) error {
8686
hdrFunc := func(filename string) string {
8787
base := filepath.Base(filename)
8888
name := strings.TrimSuffix(base, path.Ext(base))
89-
title := cases.Title(language.Und, cases.NoLower).String(strings.Replace(name, "_", " ", -1))
89+
title := cases.Title(language.Und, cases.NoLower).String(strings.ReplaceAll(name, "_", " "))
9090
return fmt.Sprintf("---\ntitle: \"%s\"\n---\n\n", title)
9191
}
9292

cmd/helm/repo_update.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ func updateCharts(repos []*repo.ChartRepository, out io.Writer, failOnRepoUpdate
136136
wg.Wait()
137137

138138
if len(repoFailList) > 0 && failOnRepoUpdateFail {
139-
return fmt.Errorf("Failed to update the following repositories: %s",
140-
repoFailList)
139+
return fmt.Errorf("Failed to update the following repositories: %s", repoFailList) //nolint:staticcheck
141140
}
142141

143142
fmt.Fprintln(out, "Update Complete. ⎈Happy Helming!⎈")

cmd/helm/template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func writeToFile(outputDir string, name string, data string, append bool) error
234234

235235
defer f.Close()
236236

237-
_, err = f.WriteString(fmt.Sprintf("---\n# Source: %s\n%s\n", name, data))
237+
_, err = fmt.Fprintf(f, "---\n# Source: %s\n%s\n", name, data)
238238

239239
if err != nil {
240240
return err

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module helm.sh/helm/v3
22

3-
go 1.24.0
3+
go 1.25.0
44

55
require (
66
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24

internal/test/test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,5 @@ func update(filename string, in []byte) error {
9292
}
9393

9494
func normalize(in []byte) []byte {
95-
return bytes.Replace(in, []byte("\r\n"), []byte("\n"), -1)
95+
return bytes.ReplaceAll(in, []byte("\r\n"), []byte("\n"))
9696
}

internal/third_party/dep/fs/fs.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,28 +172,28 @@ func copyFile(src, dst string) (err error) {
172172

173173
in, err := os.Open(src)
174174
if err != nil {
175-
return
175+
return //nolint:nakedret
176176
}
177177
defer in.Close()
178178

179179
out, err := os.Create(dst)
180180
if err != nil {
181-
return
181+
return //nolint:nakedret
182182
}
183183

184184
if _, err = io.Copy(out, in); err != nil {
185185
out.Close()
186-
return
186+
return //nolint:nakedret
187187
}
188188

189189
// Check for write errors on Close
190190
if err = out.Close(); err != nil {
191-
return
191+
return //nolint:nakedret
192192
}
193193

194194
si, err := os.Stat(src)
195195
if err != nil {
196-
return
196+
return //nolint:nakedret
197197
}
198198

199199
// Temporary fix for Go < 1.9
@@ -205,7 +205,7 @@ func copyFile(src, dst string) (err error) {
205205
}
206206
err = os.Chmod(dst, si.Mode())
207207

208-
return
208+
return //nolint:nakedret
209209
}
210210

211211
// cloneSymlink will create a new symlink that points to the resolved path of sl.

internal/third_party/dep/fs/fs_test.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,11 @@ package fs
3333

3434
import (
3535
"os"
36-
"os/exec"
3736
"path/filepath"
3837
"runtime"
39-
"sync"
4038
"testing"
4139
)
4240

43-
var (
44-
mu sync.Mutex
45-
)
46-
4741
func TestRenameWithFallback(t *testing.T) {
4842
dir := t.TempDir()
4943

@@ -360,19 +354,6 @@ func TestCopyFile(t *testing.T) {
360354
}
361355
}
362356

363-
func cleanUpDir(dir string) {
364-
// NOTE(mattn): It seems that sometimes git.exe is not dead
365-
// when cleanUpDir() is called. But we do not know any way to wait for it.
366-
if runtime.GOOS == "windows" {
367-
mu.Lock()
368-
exec.Command(`taskkill`, `/F`, `/IM`, `git.exe`).Run()
369-
mu.Unlock()
370-
}
371-
if dir != "" {
372-
os.RemoveAll(dir)
373-
}
374-
}
375-
376357
func TestCopyFileSymlink(t *testing.T) {
377358
tempdir := t.TempDir()
378359

internal/third_party/k8s.io/kubernetes/deployment/util/deploymentutil.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package util
17+
package util //nolint:revive
1818

1919
import (
2020
"context"

0 commit comments

Comments
 (0)