File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -254,13 +254,16 @@ func (f *file) glob(pattern string) ([]string, error) {
254
254
255
255
var err error
256
256
f .files .Range (func (name string , sub * file ) bool {
257
- if ok , err := filepath .Match (parts [0 ], name ); err != nil {
257
+ var ok bool
258
+ ok , err = filepath .Match (parts [0 ], name )
259
+ if err != nil {
258
260
return false
259
261
} else if ok {
260
262
if len (parts ) == 1 {
261
263
entries = append (entries , name )
262
264
} else {
263
- subEntries , err := sub .glob (strings .Join (parts [1 :], separator ))
265
+ var subEntries []string
266
+ subEntries , err = sub .glob (strings .Join (parts [1 :], separator ))
264
267
if err != nil {
265
268
return false
266
269
}
Original file line number Diff line number Diff line change @@ -394,6 +394,11 @@ func TestFS_Glob(t *testing.T) {
394
394
pattern : "nosuch" ,
395
395
wantErr : assert .NoError ,
396
396
},
397
+ {
398
+ name : "invalid pattern" ,
399
+ pattern : "[abc" ,
400
+ wantErr : assert .Error ,
401
+ },
397
402
}
398
403
399
404
for _ , tt := range tests {
You can’t perform that action at this time.
0 commit comments