Merge pull request #3015 from Fish-pro/cleanup/errorsis

Check for err judgments by `==` and fix it
This commit is contained in:
karmada-bot 2023-01-04 17:43:55 +08:00 committed by GitHub
commit 1c612f63b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package genericresource
import (
"errors"
"fmt"
"net/url"
"os"
@ -158,7 +159,7 @@ func expandIfFilePattern(pattern string) ([]string, error) {
if err == nil && len(matches) == 0 {
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 matches, err