Skip to content

Commit a7e4c75

Browse files
fix(tests): replace assert.Error with require.Error for better error handling
1 parent 5e1e949 commit a7e4c75

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ use = "another-run-before2"`)
464464

465465
createFile(t, fs, "fail-"+testID+".inc.toml", `[two]`)
466466
_, err := LoadFile(fs, configFile, "")
467-
assert.Error(t, err)
467+
require.Error(t, err)
468468
assert.Regexp(t, ".+ is in hcl format, includes must use the same format", err.Error())
469469
})
470470

@@ -479,7 +479,7 @@ use = "another-run-before2"`)
479479

480480
createFile(t, fs, "fail-"+testID+".inc.hcl", `one { }`)
481481
_, err := LoadFile(fs, configFile, "")
482-
assert.Error(t, err)
482+
require.Error(t, err)
483483
assert.Regexp(t, "hcl format .+ cannot be used in includes from toml", err.Error())
484484
})
485485

fuse/memfs.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,16 @@ func (memfs *memFS) OnAdd(ctx context.Context) {
100100
func fileInfoToAttr(fileInfo iofs.FileInfo) fuse.Attr {
101101
var out fuse.Attr
102102
if header, ok := fileInfo.Sys().(*tar.Header); ok {
103-
out.Mode = uint32(header.Mode)
104-
out.Size = uint64(header.Size)
105-
out.Uid = uint32(header.Uid)
106-
out.Gid = uint32(header.Gid)
103+
out.Mode = uint32(header.Mode) //nolint:gosec
104+
out.Size = uint64(header.Size) //nolint:gosec
105+
out.Uid = uint32(header.Uid) //nolint:gosec
106+
out.Gid = uint32(header.Gid) //nolint:gosec
107107
out.SetTimes(&header.AccessTime, &header.ModTime, &header.ChangeTime)
108108
} else {
109109
out.Mode = uint32(fileInfo.Mode())
110-
out.Size = uint64(fileInfo.Size())
111-
out.Uid = uint32(os.Geteuid())
112-
out.Gid = uint32(os.Getegid())
110+
out.Size = uint64(fileInfo.Size()) //nolint:gosec
111+
out.Uid = uint32(os.Geteuid()) //nolint:gosec
112+
out.Gid = uint32(os.Getegid()) //nolint:gosec
113113
modTime := fileInfo.ModTime()
114114
out.SetTimes(nil, &modTime, nil)
115115
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ require (
1010
github.com/creativeprojects/go-selfupdate v1.5.0
1111
github.com/distatus/battery v0.11.0
1212
github.com/fatih/color v1.18.0
13+
github.com/hanwen/go-fuse/v2 v2.8.0
1314
github.com/joho/godotenv v1.5.1
1415
github.com/mackerelio/go-osstat v0.2.6
1516
github.com/mattn/go-colorable v0.1.14
@@ -23,6 +24,7 @@ require (
2324
github.com/spf13/pflag v1.0.7
2425
github.com/spf13/viper v1.19.0
2526
github.com/stretchr/testify v1.10.0
27+
golang.org/x/crypto v0.40.0
2628
golang.org/x/sys v0.34.0
2729
golang.org/x/term v0.33.0
2830
golang.org/x/text v0.27.0
@@ -44,7 +46,6 @@ require (
4446
github.com/google/go-github/v30 v30.1.0 // indirect
4547
github.com/google/go-querystring v1.1.0 // indirect
4648
github.com/govalues/decimal v0.1.36 // indirect
47-
github.com/hanwen/go-fuse/v2 v2.7.2 // indirect
4849
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
4950
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
5051
github.com/hashicorp/go-version v1.7.0 // indirect
@@ -71,7 +72,6 @@ require (
7172
github.com/xanzy/go-gitlab v0.115.0 // indirect
7273
github.com/yusufpapurcu/wmi v1.2.4 // indirect
7374
go.uber.org/multierr v1.11.0 // indirect
74-
golang.org/x/crypto v0.38.0 // indirect
7575
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
7676
golang.org/x/oauth2 v0.30.0 // indirect
7777
golang.org/x/time v0.11.0 // indirect

go.sum

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD
4848
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
4949
github.com/govalues/decimal v0.1.36 h1:dojDpsSvrk0ndAx8+saW5h9WDIHdWpIwrH/yhl9olyU=
5050
github.com/govalues/decimal v0.1.36/go.mod h1:Ee7eI3Llf7hfqDZtpj8Q6NCIgJy1iY3kH1pSwDrNqlM=
51-
github.com/hanwen/go-fuse/v2 v2.7.2 h1:SbJP1sUP+n1UF8NXBA14BuojmTez+mDgOk0bC057HQw=
52-
github.com/hanwen/go-fuse/v2 v2.7.2/go.mod h1:ugNaD/iv5JYyS1Rcvi57Wz7/vrLQJo10mmketmoef48=
51+
github.com/hanwen/go-fuse/v2 v2.8.0 h1:wV8rG7rmCz8XHSOwBZhG5YcVqcYjkzivjmbaMafPlAs=
52+
github.com/hanwen/go-fuse/v2 v2.8.0/go.mod h1:yE6D2PqWwm3CbYRxFXV9xUd8Md5d6NG0WBs5spCswmI=
5353
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
5454
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
5555
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
@@ -67,6 +67,8 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
6767
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
6868
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
6969
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
70+
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
71+
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
7072
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 h1:PpXWgLPs+Fqr325bN2FD2ISlRRztXibcX6e8f5FR5Dc=
7173
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg=
7274
github.com/mackerelio/go-osstat v0.2.6 h1:gs4U8BZeS1tjrL08tt5VUliVvSWP26Ai2Ob8Lr7f2i0=
@@ -79,6 +81,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
7981
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
8082
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
8183
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
84+
github.com/moby/sys/mountinfo v0.7.2 h1:1shs6aH5s4o5H2zQLn796ADW1wMrIwHsyJ2v9KouLrg=
85+
github.com/moby/sys/mountinfo v0.7.2/go.mod h1:1YOa8w8Ih7uW0wALDUgT1dTTSBrZ+HiBLGws92L2RU4=
8286
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
8387
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
8488
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
@@ -144,8 +148,8 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8
144148
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
145149
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
146150
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
147-
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
148-
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
151+
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
152+
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
149153
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 h1:R84qjqJb5nVJMxqWYb3np9L5ZsaDtB+a39EqjV0JSUM=
150154
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0/go.mod h1:S9Xr4PYopiDyqSyp5NjCrhFrqg6A5zA2E/iPHPhqnS8=
151155
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=

0 commit comments

Comments
 (0)