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) {
254254
255255 var err error
256256 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 {
258260 return false
259261 } else if ok {
260262 if len (parts ) == 1 {
261263 entries = append (entries , name )
262264 } 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 ))
264267 if err != nil {
265268 return false
266269 }
Original file line number Diff line number Diff line change @@ -394,6 +394,11 @@ func TestFS_Glob(t *testing.T) {
394394 pattern : "nosuch" ,
395395 wantErr : assert .NoError ,
396396 },
397+ {
398+ name : "invalid pattern" ,
399+ pattern : "[abc" ,
400+ wantErr : assert .Error ,
401+ },
397402 }
398403
399404 for _ , tt := range tests {
You can’t perform that action at this time.
0 commit comments