From 617b3e870138a1708dcd1ead073e06ac99675745 Mon Sep 17 00:00:00 2001 From: Sasha Melentyev Date: Wed, 18 Jan 2023 00:49:19 +0300 Subject: [PATCH] Remove redundant err and use %w verb for err Signed-off-by: Sasha Melentyev --- internal/httprule/parse.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/httprule/parse.go b/internal/httprule/parse.go index 52a8561f0f9..65ffcf5cf87 100644 --- a/internal/httprule/parse.go +++ b/internal/httprule/parse.go @@ -167,7 +167,7 @@ func (p *parser) segment() (segment, error) { if err != nil { return nil, fmt.Errorf("segment neither wildcards, literal or variable: %w", err) } - return v, err + return v, nil } func (p *parser) literal() (segment, error) { @@ -192,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{}} @@ -219,7 +219,7 @@ func (p *parser) fieldPath() (string, error) { } 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) }