Skip to content

Commit f91dbfc

Browse files
committed
chore: Update tools
1 parent 25ea2da commit f91dbfc

22 files changed

+39
-48
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
FIND_TYPOS_VERSION: 0.0.3 # https://github.com/twpayne/find-typos/tags
1919
GO_VERSION: 1.23.1 # https://go.dev/doc/devel/release
2020
GOFUMPT_VERSION: 0.7.0 # https://github.com/mvdan/gofumpt/releases
21-
GOLANGCI_LINT_VERSION: 1.60.3 # https://github.com/golangci/golangci-lint/releases
21+
GOLANGCI_LINT_VERSION: 1.61.0 # https://github.com/golangci/golangci-lint/releases
2222
GOLINES_VERSION: 0.12.2 # https://github.com/segmentio/golines/releases
2323
GORELEASER_VERSION: 2.2.0 # https://github.com/goreleaser/goreleaser/releases
2424
GOVERSIONINFO_VERSION: 1.4.1 # https://github.com/josephspurrier/goversioninfo/releases

.golangci.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ linters:
3131
- goimports
3232
- gomodguard
3333
- goprintffuncname
34-
- gosec
3534
- gosimple
3635
- gosmopolitan
3736
- govet
@@ -95,6 +94,7 @@ linters:
9594
- goheader
9695
- gomnd
9796
- gomoddirectives
97+
- gosec
9898
- ireturn
9999
- lll
100100
- maintidx
@@ -154,13 +154,10 @@ issues:
154154
text: unused-parameter
155155
- linters:
156156
- forbidigo
157-
- gosec
158157
path: ^internal/cmds/
159158
- linters:
160159
- forcetypeassert
161-
- gosec
162160
path: _test\.go$
163161
- linters:
164162
- forbidigo
165-
- gosec
166163
path: assets/scripts/generate-commit.go

internal/chezmoi/ageencryption.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (e *AgeEncryption) Decrypt(ciphertext []byte) ([]byte, error) {
3737
return e.builtinDecrypt(ciphertext)
3838
}
3939

40-
cmd := exec.Command(e.Command, append(e.decryptArgs(), e.Args...)...) //nolint:gosec
40+
cmd := exec.Command(e.Command, append(e.decryptArgs(), e.Args...)...)
4141
cmd.Stdin = bytes.NewReader(ciphertext)
4242
cmd.Stderr = os.Stderr
4343
return chezmoilog.LogCmdOutput(slog.Default(), cmd)
@@ -50,11 +50,11 @@ func (e *AgeEncryption) DecryptToFile(plaintextAbsPath AbsPath, ciphertext []byt
5050
if err != nil {
5151
return err
5252
}
53-
return os.WriteFile(plaintextAbsPath.String(), plaintext, 0o644) //nolint:gosec
53+
return os.WriteFile(plaintextAbsPath.String(), plaintext, 0o644)
5454
}
5555

5656
args := append(append(e.decryptArgs(), "--output", plaintextAbsPath.String()), e.Args...)
57-
cmd := exec.Command(e.Command, args...) //nolint:gosec
57+
cmd := exec.Command(e.Command, args...)
5858
cmd.Stdin = bytes.NewReader(ciphertext)
5959
cmd.Stderr = os.Stderr
6060
return chezmoilog.LogCmdRun(slog.Default(), cmd)
@@ -66,7 +66,7 @@ func (e *AgeEncryption) Encrypt(plaintext []byte) ([]byte, error) {
6666
return e.builtinEncrypt(plaintext)
6767
}
6868

69-
cmd := exec.Command(e.Command, append(e.encryptArgs(), e.Args...)...) //nolint:gosec
69+
cmd := exec.Command(e.Command, append(e.encryptArgs(), e.Args...)...)
7070
cmd.Stdin = bytes.NewReader(plaintext)
7171
cmd.Stderr = os.Stderr
7272
return chezmoilog.LogCmdOutput(slog.Default(), cmd)
@@ -83,7 +83,7 @@ func (e *AgeEncryption) EncryptFile(plaintextAbsPath AbsPath) ([]byte, error) {
8383
}
8484

8585
args := append(append(e.encryptArgs(), e.Args...), plaintextAbsPath.String())
86-
cmd := exec.Command(e.Command, args...) //nolint:gosec
86+
cmd := exec.Command(e.Command, args...)
8787
cmd.Stderr = os.Stderr
8888
return chezmoilog.LogCmdOutput(slog.Default(), cmd)
8989
}

internal/chezmoi/chezmoi.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ package chezmoi
44
import (
55
"bufio"
66
"bytes"
7-
"crypto/md5" //nolint:gosec
8-
"crypto/sha1" //nolint:gosec
7+
"crypto/md5"
8+
"crypto/sha1"
99
"crypto/sha256"
1010
"crypto/sha512"
1111
"fmt"
@@ -20,7 +20,7 @@ import (
2020

2121
"github.com/spf13/cobra"
2222
vfs "github.com/twpayne/go-vfs/v5"
23-
"golang.org/x/crypto/ripemd160" //nolint:gosec,staticcheck
23+
"golang.org/x/crypto/ripemd160" //nolint:staticcheck
2424

2525
"github.com/twpayne/chezmoi/v2/internal/chezmoiset"
2626
)
@@ -336,7 +336,7 @@ func isReadOnly(fileInfo fs.FileInfo) bool {
336336

337337
// md5Sum returns the MD5 sum of data.
338338
func md5Sum(data []byte) []byte {
339-
md5SumArr := md5.Sum(data) //nolint:gosec
339+
md5SumArr := md5.Sum(data)
340340
return md5SumArr[:]
341341
}
342342

@@ -361,12 +361,12 @@ func modeTypeName(mode fs.FileMode) string {
361361

362362
// ripemd160Sum returns the RIPEMD-160 sum of data.
363363
func ripemd160Sum(data []byte) []byte {
364-
return ripemd160.New().Sum(data) //nolint:gosec
364+
return ripemd160.New().Sum(data)
365365
}
366366

367367
// sha1Sum returns the SHA1 sum of data.
368368
func sha1Sum(data []byte) []byte {
369-
sha1SumArr := sha1.Sum(data) //nolint:gosec
369+
sha1SumArr := sha1.Sum(data)
370370
return sha1SumArr[:]
371371
}
372372

internal/chezmoi/chezmoi_unix.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
const nativeLineEnding = "\n"
1313

1414
func init() {
15-
Umask = fs.FileMode(unix.Umask(0)) //nolint:gosec
15+
Umask = fs.FileMode(unix.Umask(0))
1616
unix.Umask(int(Umask))
1717
}
1818

internal/chezmoi/externaldiffsystem.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func (s *ExternalDiffSystem) RunScript(scriptName RelPath, dir AbsPath, data []b
199199
if !s.scriptContents {
200200
toData = nil
201201
}
202-
if err := os.WriteFile(targetAbsPath.String(), toData, 0o700); err != nil { //nolint:gosec
202+
if err := os.WriteFile(targetAbsPath.String(), toData, 0o700); err != nil {
203203
return err
204204
}
205205
if err := s.runDiffCommand(devNullAbsPath, targetAbsPath); err != nil {
@@ -325,7 +325,7 @@ func (s *ExternalDiffSystem) runDiffCommand(destAbsPath, targetAbsPath AbsPath)
325325
args = append(args, templateData.Destination, templateData.Target)
326326
}
327327

328-
cmd := exec.Command(s.command, args...) //nolint:gosec
328+
cmd := exec.Command(s.command, args...)
329329
cmd.Stdin = os.Stdin
330330
cmd.Stdout = os.Stdout
331331
cmd.Stderr = os.Stderr

internal/chezmoi/gpgencryption.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func (e *GPGEncryption) encryptArgs(plaintextAbsPath, ciphertextAbsPath AbsPath)
139139

140140
// run runs the command with args.
141141
func (e *GPGEncryption) run(args []string) error {
142-
cmd := exec.Command(e.Command, args...) //nolint:gosec
142+
cmd := exec.Command(e.Command, args...)
143143
cmd.Stdin = os.Stdin
144144
cmd.Stdout = os.Stdout
145145
cmd.Stderr = os.Stderr

internal/chezmoi/interpreter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func (i *Interpreter) ExecCommand(name string) *exec.Cmd {
1616
if i.None() {
1717
return exec.Command(name)
1818
}
19-
return exec.Command(i.Command, append(i.Args, name)...) //nolint:gosec
19+
return exec.Command(i.Command, append(i.Args, name)...)
2020
}
2121

2222
// None returns if i represents no interpreter.

internal/chezmoi/sourcestate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1714,7 +1714,7 @@ func (s *SourceState) getExternalData(
17141714
}
17151715

17161716
if external.Filter.Command != "" {
1717-
cmd := exec.Command(external.Filter.Command, external.Filter.Args...) //nolint:gosec
1717+
cmd := exec.Command(external.Filter.Command, external.Filter.Args...)
17181718
cmd.Stdin = bytes.NewReader(data)
17191719
cmd.Stderr = os.Stderr
17201720
data, err = chezmoilog.LogCmdOutput(s.logger, cmd)

internal/chezmoitest/chezmoitest.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var ageRecipientRx = regexp.MustCompile(`(?m)^Public key: ([0-9a-z]+)\s*$`)
2525
// AgeGenerateKey generates an identity in identityFile and returns the
2626
// recipient.
2727
func AgeGenerateKey(command, identityFile string) (string, error) {
28-
cmd := exec.Command(command+"-keygen", "--output", identityFile) //nolint:gosec
28+
cmd := exec.Command(command+"-keygen", "--output", identityFile)
2929
output, err := chezmoilog.LogCmdCombinedOutput(slog.Default(), cmd)
3030
if err != nil {
3131
return "", err
@@ -41,7 +41,7 @@ func AgeGenerateKey(command, identityFile string) (string, error) {
4141
// passphrase.
4242
func GPGGenerateKey(command, homeDir string) (key, passphrase string, err error) {
4343
key = "chezmoi-test-gpg-key"
44-
passphrase = "chezmoi-test-gpg-passphrase" //nolint:gosec
44+
passphrase = "chezmoi-test-gpg-passphrase"
4545
cmd := exec.Command(
4646
command,
4747
"--batch",
@@ -101,5 +101,5 @@ func mustParseFileMode(s string) fs.FileMode {
101101
if err != nil {
102102
panic(err)
103103
}
104-
return fs.FileMode(uint32(u)) //nolint:gosec
104+
return fs.FileMode(uint32(u))
105105
}

internal/cmd/config.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ func (c *Config) colorAutoFunc() bool {
733733
return false
734734
}
735735
if stdout, ok := c.stdout.(*os.File); ok {
736-
return term.IsTerminal(int(stdout.Fd())) //nolint:gosec
736+
return term.IsTerminal(int(stdout.Fd()))
737737
}
738738
return false
739739
}
@@ -2270,7 +2270,7 @@ func (c *Config) persistentStateFile() (chezmoi.AbsPath, error) {
22702270
// progressAutoFunc detects whether progress bars should be displayed.
22712271
func (c *Config) progressAutoFunc() bool {
22722272
if stdout, ok := c.stdout.(*os.File); ok {
2273-
return term.IsTerminal(int(stdout.Fd())) //nolint:gosec
2273+
return term.IsTerminal(int(stdout.Fd()))
22742274
}
22752275
return false
22762276
}
@@ -2720,7 +2720,7 @@ func (c *Config) writeOutput(data []byte) error {
27202720
_, err := c.stdout.Write(data)
27212721
return err
27222722
}
2723-
return os.WriteFile(c.outputAbsPath.String(), data, 0o666) //nolint:gosec
2723+
return os.WriteFile(c.outputAbsPath.String(), data, 0o666)
27242724
}
27252725

27262726
type writePathsOptions struct {

internal/cmd/doctorcmd.go

+2-8
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ func (c *binaryCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath)
492492
return checkResultOK, fmt.Sprintf("found %s", pathAbsPath)
493493
}
494494

495-
cmd := exec.Command(pathAbsPath.String(), c.versionArgs...) //nolint:gosec
495+
cmd := exec.Command(pathAbsPath.String(), c.versionArgs...)
496496
output, err := chezmoilog.LogCmdCombinedOutput(slog.Default(), cmd)
497497
if err != nil {
498498
return checkResultFailed, err.Error()
@@ -583,13 +583,7 @@ func (c *dirCheck) Run(system chezmoi.System, homeDirAbsPath chezmoi.AbsPath) (c
583583
if dirEntry.Name() != ".git" {
584584
continue
585585
}
586-
cmd := exec.Command( //nolint:gosec
587-
"git",
588-
"-C",
589-
c.dirname.String(),
590-
"status",
591-
"--porcelain=v2",
592-
)
586+
cmd := exec.Command("git", "-C", c.dirname.String(), "status", "--porcelain=v2")
593587
cmd.Stderr = os.Stderr
594588
output, err := cmd.Output()
595589
if err != nil {

internal/cmd/dopplertemplatefuncs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (c *Config) dopplerOutput(args []string) ([]byte, error) {
8383
if data, ok := c.Doppler.outputCache[key]; ok {
8484
return data, nil
8585
}
86-
cmd := exec.Command(c.Doppler.Command, args...) //nolint:gosec
86+
cmd := exec.Command(c.Doppler.Command, args...)
8787
// Always run the doppler command in the destination path because doppler uses
8888
// relative paths to find its .doppler.json config file.
8989
cmd.Dir = c.DestDirAbsPath.String()

internal/cmd/hcpvaultsecretsttemplatefuncs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (c *Config) vltOutput(args []string) ([]byte, error) {
9090
return data, nil
9191
}
9292

93-
cmd := exec.Command(c.HCPVaultSecrets.Command, args...) //nolint:gosec
93+
cmd := exec.Command(c.HCPVaultSecrets.Command, args...)
9494
// Always run the vlt command in the destination path because vlt uses
9595
// relative paths to find its .vlt.json config file.
9696
cmd.Dir = c.DestDirAbsPath.String()

internal/cmd/inittemplatefuncs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func (c *Config) stdinIsATTYInitTemplateFunc() bool {
2020
if !ok {
2121
return false
2222
}
23-
return term.IsTerminal(int(file.Fd())) //nolint:gosec
23+
return term.IsTerminal(int(file.Fd()))
2424
}
2525

2626
func (c *Config) writeToStdout(args ...string) string {

internal/cmd/keepassxctemplatefuncs.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func (c *Config) keepassxcOutputCachePassword(command string, args ...string) ([
167167
cmdArgs = append(cmdArgs, c.Keepassxc.Args...)
168168
cmdArgs = append(cmdArgs, c.Keepassxc.Database.String())
169169
cmdArgs = append(cmdArgs, args...)
170-
cmd := exec.Command(c.Keepassxc.Command, cmdArgs...) //nolint:gosec
170+
cmd := exec.Command(c.Keepassxc.Command, cmdArgs...)
171171
if c.Keepassxc.password == "" && c.Keepassxc.Prompt {
172172
password, err := c.readPassword(fmt.Sprintf("Enter password to unlock %s: ", c.Keepassxc.Database))
173173
if err != nil {
@@ -204,7 +204,7 @@ func (c *Config) keepassxcOutputOpen(command string, args ...string) ([]byte, er
204204
cmdArgs := []string{"open"}
205205
cmdArgs = append(cmdArgs, c.Keepassxc.Args...)
206206
cmdArgs = append(cmdArgs, c.Keepassxc.Database.String())
207-
cmd := exec.Command(c.Keepassxc.Command, cmdArgs...) //nolint:gosec
207+
cmd := exec.Command(c.Keepassxc.Command, cmdArgs...)
208208
env := os.Environ()
209209
// Ensure prompt is in English.
210210
env = append(env, "LANGUAGE=en")

internal/cmd/onepasswordtemplatefuncs.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func (c *Config) onepasswordGetOrRefreshSessionToken(args *onepasswordArgs) (str
181181
commandArgs = append(commandArgs, "--session", session)
182182
}
183183

184-
cmd := exec.Command(c.Onepassword.Command, commandArgs...) //nolint:gosec
184+
cmd := exec.Command(c.Onepassword.Command, commandArgs...)
185185
cmd.Stdin = os.Stdin
186186
cmd.Stderr = os.Stderr
187187
output, err := chezmoilog.LogCmdOutput(c.logger, cmd)
@@ -235,7 +235,7 @@ func (c *Config) onepasswordOutput(args *onepasswordArgs, withSessionToken withS
235235
}
236236
}
237237

238-
cmd := exec.Command(c.Onepassword.Command, commandArgs...) //nolint:gosec
238+
cmd := exec.Command(c.Onepassword.Command, commandArgs...)
239239
cmd.Stdin = os.Stdin
240240
cmd.Stderr = os.Stderr
241241
output, err := chezmoilog.LogCmdOutput(c.logger, cmd)

internal/cmd/passtemplatefuncs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (c *Config) passOutput(id string) ([]byte, error) {
5151
}
5252

5353
args := []string{"show", id}
54-
cmd := exec.Command(c.Pass.Command, args...) //nolint:gosec
54+
cmd := exec.Command(c.Pass.Command, args...)
5555
cmd.Stdin = os.Stdin
5656
cmd.Stderr = os.Stderr
5757
output, err := chezmoilog.LogCmdOutput(c.logger, cmd)

internal/cmd/rbwtemplatefuncs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (c *Config) rbwOutput(args []string) ([]byte, error) {
5858
return data, nil
5959
}
6060

61-
cmd := exec.Command(c.RBW.Command, args...) //nolint:gosec
61+
cmd := exec.Command(c.RBW.Command, args...)
6262
cmd.Stdin = os.Stdin
6363
cmd.Stderr = os.Stderr
6464
output, err := chezmoilog.LogCmdOutput(c.logger, cmd)

internal/cmd/secrettemplatefuncs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (c *Config) secretOutput(args []string) ([]byte, error) {
4545
}
4646

4747
args = append(slices.Clone(c.Secret.Args), args...)
48-
cmd := exec.Command(c.Secret.Command, args...) //nolint:gosec
48+
cmd := exec.Command(c.Secret.Command, args...)
4949
cmd.Stdin = os.Stdin
5050
cmd.Stderr = os.Stderr
5151
output, err := chezmoilog.LogCmdOutput(c.logger, cmd)

internal/cmd/textconv.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (t textConv) convert(path string, data []byte) ([]byte, error) {
3737
return data, nil
3838
}
3939

40-
cmd := exec.Command(longestPatternElement.Command, longestPatternElement.Args...) //nolint:gosec
40+
cmd := exec.Command(longestPatternElement.Command, longestPatternElement.Args...)
4141
cmd.Stdin = bytes.NewReader(data)
4242
cmd.Stderr = os.Stderr
4343
return chezmoilog.LogCmdOutput(slog.Default(), cmd)

internal/cmd/vaulttemplatefuncs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func (c *Config) vaultTemplateFunc(key string) any {
1919
}
2020

2121
args := []string{"kv", "get", "-format=json", key}
22-
cmd := exec.Command(c.Vault.Command, args...) //nolint:gosec
22+
cmd := exec.Command(c.Vault.Command, args...)
2323
cmd.Stdin = os.Stdin
2424
cmd.Stderr = os.Stderr
2525
output, err := chezmoilog.LogCmdOutput(c.logger, cmd)

0 commit comments

Comments
 (0)