Merge pull request #3015 from Fish-pro/cleanup/errorsis
Check for err judgments by `==` and fix it
This commit is contained in:
commit
1c612f63b7
|
@ -1,6 +1,7 @@
|
||||||
package genericresource
|
package genericresource
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
@ -158,7 +159,7 @@ func expandIfFilePattern(pattern string) ([]string, error) {
|
||||||
if err == nil && len(matches) == 0 {
|
if err == nil && len(matches) == 0 {
|
||||||
return nil, fmt.Errorf("the path %q does not exist", pattern)
|
return nil, fmt.Errorf("the path %q does not exist", pattern)
|
||||||
}
|
}
|
||||||
if err == filepath.ErrBadPattern {
|
if errors.Is(err, filepath.ErrBadPattern) {
|
||||||
return nil, fmt.Errorf("pattern %q is not valid: %v", pattern, err)
|
return nil, fmt.Errorf("pattern %q is not valid: %v", pattern, err)
|
||||||
}
|
}
|
||||||
return matches, err
|
return matches, err
|
||||||
|
|
Loading…
Reference in New Issue