diff --git a/go.mod b/go.mod index 2a09107bc4..c3e914872b 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( github.com/stretchr/testify v1.7.1 github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 - github.com/yashtewari/glob-intersection v0.0.0-20180916065949-5c77d914dd0b + github.com/yashtewari/glob-intersection v0.1.0 go.opencensus.io v0.23.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.30.0 go.opentelemetry.io/otel v1.5.0 diff --git a/go.sum b/go.sum index 915ba708f1..574635793c 100644 --- a/go.sum +++ b/go.sum @@ -319,8 +319,8 @@ github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2 github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yashtewari/glob-intersection v0.0.0-20180916065949-5c77d914dd0b h1:vVRagRXf67ESqAb72hG2C/ZwI8NtJF2u2V76EsuOHGY= -github.com/yashtewari/glob-intersection v0.0.0-20180916065949-5c77d914dd0b/go.mod h1:HptNXiXVDcJjXe9SqMd0v2FsL9f8dz4GnXgltU6q/co= +github.com/yashtewari/glob-intersection v0.1.0 h1:6gJvMYQlTDOL3dMsPF6J0+26vwX9MB8/1q3uAdhmTrg= +github.com/yashtewari/glob-intersection v0.1.0/go.mod h1:LK7pIC3piUjovexikBbJ26Yml7g8xa5bsjfx2v1fwok= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/vendor/github.com/yashtewari/glob-intersection/go.mod b/vendor/github.com/yashtewari/glob-intersection/go.mod new file mode 100644 index 0000000000..aded87cfc5 --- /dev/null +++ b/vendor/github.com/yashtewari/glob-intersection/go.mod @@ -0,0 +1,3 @@ +module github.com/yashtewari/glob-intersection + +go 1.17 diff --git a/vendor/github.com/yashtewari/glob-intersection/match.go b/vendor/github.com/yashtewari/glob-intersection/match.go index 45a988a854..63c75c8427 100644 --- a/vendor/github.com/yashtewari/glob-intersection/match.go +++ b/vendor/github.com/yashtewari/glob-intersection/match.go @@ -1,7 +1,7 @@ package gintersect import ( - "github.com/pkg/errors" + "errors" ) var ( diff --git a/vendor/github.com/yashtewari/glob-intersection/tokenize.go b/vendor/github.com/yashtewari/glob-intersection/tokenize.go index 0b67431650..df0efe5aed 100644 --- a/vendor/github.com/yashtewari/glob-intersection/tokenize.go +++ b/vendor/github.com/yashtewari/glob-intersection/tokenize.go @@ -3,7 +3,7 @@ package gintersect import ( "fmt" - "github.com/pkg/errors" + "errors" ) // Modifier is a special character that affects lexical analysis. @@ -65,7 +65,7 @@ func nextToken(index int, input []rune) (newIndex int, token Token, err error) { case TTSet: if r == ']' { - err = errors.Wrap(ErrInvalidInput, invalidInputMessage(input, newIndex, "set-close ']' with no preceding '['")) + err = invalidInputMessageErrorf(input, newIndex, "set-close ']' with no preceding '[': %w", ErrInvalidInput) return } @@ -75,15 +75,15 @@ func nextToken(index int, input []rune) (newIndex int, token Token, err error) { } default: - panic(errors.Wrapf(errBadImplementation, "encountered unhandled token type: %v", ttype)) + panic(fmt.Errorf("encountered unhandled token type %v: %w", ttype, errBadImplementation)) } } else if _, ok := flagRunes[r]; ok { - err = errors.Wrap(ErrInvalidInput, invalidInputMessage(input, newIndex, "flag '%s' must be preceded by a non-flag", string(r))) + err = invalidInputMessageErrorf(input, newIndex, "flag '%s' must be preceded by a non-flag: %w", string(r), ErrInvalidInput) return } else if m, ok := modifierRunes[r]; ok { - panic(errors.Wrapf(errBadImplementation, "encountered unhandled modifier: %v", m)) + panic(fmt.Errorf("encountered unhandled modifier %v: %w", m, errBadImplementation)) } else { // Nothing special to do. token = NewCharacter(r) @@ -133,11 +133,11 @@ func nextTokenSet(index int, input []rune) (newIndex int, t Token, err error) { switch r { case '-': if !prevExists { - err = errors.Wrap(ErrInvalidInput, invalidInputMessage(input, newIndex, "range character '-' must be preceded by a Unicode character")) + err = invalidInputMessageErrorf(input, newIndex, "range character '-' must be preceded by a Unicode character: %w", ErrInvalidInput) return } if newIndex >= len(input)-1 { - err = errors.Wrap(ErrInvalidInput, invalidInputMessage(input, newIndex, "range character '-' must be followed by a Unicode character")) + err = invalidInputMessageErrorf(input, newIndex, "range character '-' must be followed by a Unicode character: %w", ErrInvalidInput) return } @@ -146,12 +146,12 @@ func nextTokenSet(index int, input []rune) (newIndex int, t Token, err error) { if !escaped { if r == ']' || r == '-' { - err = errors.Wrap(ErrInvalidInput, invalidInputMessage(input, newIndex, "range character '-' cannot be followed by a special symbol")) + err = invalidInputMessageErrorf(input, newIndex, "range character '-' cannot be followed by a special symbol: %w", ErrInvalidInput) return } } if r < prev { - err = errors.Wrap(ErrInvalidInput, invalidInputMessage(input, newIndex, "range is out of order: '%s' comes before '%s' in Unicode", string(r), string(prev))) + err = invalidInputMessageErrorf(input, newIndex, "range is out of order: '%s' comes before '%s' in Unicode: %w", string(r), string(prev), ErrInvalidInput) return } @@ -183,7 +183,7 @@ func nextTokenSet(index int, input []rune) (newIndex int, t Token, err error) { // End of input is reached before the set completes. if !complete { - err = errors.Wrap(ErrInvalidInput, invalidInputMessage(input, newIndex, "found [ without matching ]")) + err = invalidInputMessageErrorf(input, newIndex, "found [ without matching ]: %w", ErrInvalidInput) } else { t = NewSet(runes) } @@ -233,10 +233,10 @@ func nextRune(index int, input []rune) (newIndex int, r rune, escaped bool, err if index < len(input)-1 { newIndex, r, escaped = index+2, input[index+1], true } else if index == len(input)-1 { - err = errors.Wrap(ErrInvalidInput, invalidInputMessage(input, index, "input ends with a \\ (escape) character")) + err = invalidInputMessageErrorf(input, index, "input ends with a \\ (escape) character: %w", ErrInvalidInput) } default: - panic(errors.Wrapf(errBadImplementation, "encountered unhandled modifier: %v", m)) + panic(fmt.Errorf("encountered unhandled modifier %v: %w", m, errBadImplementation)) } } else { newIndex, r, escaped = index+1, input[index], false @@ -245,7 +245,8 @@ func nextRune(index int, input []rune) (newIndex int, r rune, escaped bool, err return } -// invalidInputMessage wraps the message describing invalid input with the input itself and index at which it is invalid. -func invalidInputMessage(input []rune, index int, message string, args ...interface{}) string { - return fmt.Sprintf("input:%s, pos:%d, %s", string(input), index, fmt.Sprintf(message, args...)) +// invalidInputMessageErrorf wraps the message describing invalid input with the input itself and index at which it is invalid. +func invalidInputMessageErrorf(input []rune, index int, message string, args ...interface{}) error { + message = fmt.Sprintf("input:%s, pos:%d, %s", string(input), index, message) + return fmt.Errorf(message, args...) } diff --git a/vendor/modules.txt b/vendor/modules.txt index f5c7253cde..5d6cd3ad8a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -180,7 +180,7 @@ github.com/xeipuuv/gojsonpointer # github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 ## explicit github.com/xeipuuv/gojsonreference -# github.com/yashtewari/glob-intersection v0.0.0-20180916065949-5c77d914dd0b +# github.com/yashtewari/glob-intersection v0.1.0 ## explicit github.com/yashtewari/glob-intersection # go.opencensus.io v0.23.0