Commit a0f6687
Make ErrBadName checkable via errors.Is() (#1462)
* Make ErrBadName checkable via errors.Is()
The function IsErrBadName says it is deprecated and directs the user to
use errors.Is(), but that will never return true because this error is
custom based on the tag value.
This fixes that problem by implementing an Is() function on ErrBadName
so that errors.Is() can properly identify the error as an ErrBadName.
Usage can now be: errors.Is(err, &ErrBadName{})
Signed-off-by: Craig Jellick <craig@acorn.io>
* Update pkg/name/errors_test.go
Co-authored-by: Jason Hall <jason@chainguard.dev>
Signed-off-by: Craig Jellick <craig@acorn.io>
Co-authored-by: Jason Hall <jason@chainguard.dev>1 parent 7268da0 commit a0f6687
2 files changed
+9
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
31 | 37 | | |
32 | 38 | | |
33 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
0 commit comments