From 6af93cd2bd89d38ade8d9384fe3798aed1a38a65 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Sat, 4 Feb 2023 20:48:57 -0500 Subject: Remove uses of pkg/errors Signed-off-by: Dave Henderson --- tmpl/tmpl.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'tmpl') diff --git a/tmpl/tmpl.go b/tmpl/tmpl.go index 7021b72b..c4f6aefd 100644 --- a/tmpl/tmpl.go +++ b/tmpl/tmpl.go @@ -3,10 +3,9 @@ package tmpl import ( "bytes" + "fmt" "path/filepath" "text/template" - - "github.com/pkg/errors" ) // Template - @@ -68,7 +67,7 @@ func (t *Template) Exec(name string, tmplcontext ...interface{}) (string, error) } tmpl := t.root.Lookup(name) if tmpl == nil { - return "", errors.Errorf(`template "%s" not defined`, name) + return "", fmt.Errorf(`template "%s" not defined`, name) } return render(tmpl, ctx) } @@ -87,11 +86,11 @@ func (t *Template) parseArgs(args ...interface{}) (name, in string, ctx interfac ctx = t.defaultCtx if len(args) == 0 || len(args) > 3 { - return "", "", nil, errors.Errorf("wrong number of args for tpl: want 1, 2, or 3 - got %d", len(args)) + return "", "", nil, fmt.Errorf("wrong number of args for tpl: want 1, 2, or 3 - got %d", len(args)) } first, ok := args[0].(string) if !ok { - return "", "", nil, errors.Errorf("wrong input: first arg must be string, got %T", args[0]) + return "", "", nil, fmt.Errorf("wrong input: first arg must be string, got %T", args[0]) } switch len(args) { @@ -112,7 +111,7 @@ func (t *Template) parseArgs(args ...interface{}) (name, in string, ctx interfac var ok bool in, ok = args[1].(string) if !ok { - return "", "", nil, errors.Errorf("wrong input: second arg (in) must be string, got %T", args[0]) + return "", "", nil, fmt.Errorf("wrong input: second arg (in) must be string, got %T", args[0]) } ctx = args[2] } -- cgit v1.2.3