diff options
Diffstat (limited to 'vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule')
| -rw-r--r-- | vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/fuzz.go | 4 | ||||
| -rw-r--r-- | vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/parse.go | 30 | 
2 files changed, 17 insertions, 17 deletions
diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/fuzz.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/fuzz.go index 138f7c12f..c056bd305 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/fuzz.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/fuzz.go @@ -1,10 +1,10 @@ +//go:build gofuzz  // +build gofuzz  package httprule  func Fuzz(data []byte) int { -	_, err := Parse(string(data)) -	if err != nil { +	if _, err := Parse(string(data)); err != nil {  		return 0  	}  	return 0 diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/parse.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/parse.go index 5edd784e6..65ffcf5cf 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/parse.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/parse.go @@ -1,6 +1,7 @@  package httprule  import ( +	"errors"  	"fmt"  	"strings"  ) @@ -164,9 +165,9 @@ func (p *parser) segment() (segment, error) {  	v, err := p.variable()  	if err != nil { -		return nil, fmt.Errorf("segment neither wildcards, literal or variable: %v", err) +		return nil, fmt.Errorf("segment neither wildcards, literal or variable: %w", err)  	} -	return v, err +	return v, nil  }  func (p *parser) literal() (segment, error) { @@ -191,7 +192,7 @@ func (p *parser) variable() (segment, error) {  	if _, err := p.accept("="); err == nil {  		segs, err = p.segments()  		if err != nil { -			return nil, fmt.Errorf("invalid segment in variable %q: %v", path, err) +			return nil, fmt.Errorf("invalid segment in variable %q: %w", path, err)  		}  	} else {  		segs = []segment{wildcard{}} @@ -213,12 +214,12 @@ func (p *parser) fieldPath() (string, error) {  	}  	components := []string{c}  	for { -		if _, err = p.accept("."); err != nil { +		if _, err := p.accept("."); err != nil {  			return strings.Join(components, "."), nil  		}  		c, err := p.accept(typeIdent)  		if err != nil { -			return "", fmt.Errorf("invalid field path component: %v", err) +			return "", fmt.Errorf("invalid field path component: %w", err)  		}  		components = append(components, c)  	} @@ -237,10 +238,8 @@ const (  	typeEOF     = termType("$")  ) -const ( -	// eof is the terminal symbol which always appears at the end of token sequence. -	eof = "\u0000" -) +// eof is the terminal symbol which always appears at the end of token sequence. +const eof = "\u0000"  // accept tries to accept a token in "p".  // This function consumes a token and returns it if it matches to the specified "term". @@ -275,11 +274,12 @@ func (p *parser) accept(term termType) (string, error) {  // expectPChars determines if "t" consists of only pchars defined in RFC3986.  //  // https://www.ietf.org/rfc/rfc3986.txt, P.49 -//   pchar         = unreserved / pct-encoded / sub-delims / ":" / "@" -//   unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~" -//   sub-delims    = "!" / "$" / "&" / "'" / "(" / ")" -//                 / "*" / "+" / "," / ";" / "=" -//   pct-encoded   = "%" HEXDIG HEXDIG +// +//	pchar         = unreserved / pct-encoded / sub-delims / ":" / "@" +//	unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~" +//	sub-delims    = "!" / "$" / "&" / "'" / "(" / ")" +//	              / "*" / "+" / "," / ";" / "=" +//	pct-encoded   = "%" HEXDIG HEXDIG  func expectPChars(t string) error {  	const (  		init = iota @@ -333,7 +333,7 @@ func expectPChars(t string) error {  // expectIdent determines if "ident" is a valid identifier in .proto schema ([[:alpha:]_][[:alphanum:]_]*).  func expectIdent(ident string) error {  	if ident == "" { -		return fmt.Errorf("empty identifier") +		return errors.New("empty identifier")  	}  	for pos, r := range ident {  		switch {  | 
