diff options
author | bogem <albertnigma@gmail.com> | 2016-11-18 22:54:57 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-11-22 23:43:55 +0100 |
commit | dec1706ae0439bc6241332c6c9e7e6a818a203f0 (patch) | |
tree | 648cc18cfdef629c87d389bcd37601355dd77bb2 /tpl | |
parent | 1f130fd69247aa3ae2e08560cd56537b32ef3d80 (diff) |
commands, hugolib, parser, tpl: Use errors.New instead of fmt.Errorf
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/template_funcs.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tpl/template_funcs.go b/tpl/template_funcs.go index 7aa90e18b..9a2b52020 100644 --- a/tpl/template_funcs.go +++ b/tpl/template_funcs.go @@ -1676,13 +1676,13 @@ func prepareArg(value reflect.Value, argType reflect.Type) (reflect.Value, error func index(item interface{}, indices ...interface{}) (interface{}, error) { v := reflect.ValueOf(item) if !v.IsValid() { - return nil, fmt.Errorf("index of untyped nil") + return nil, errors.New("index of untyped nil") } for _, i := range indices { index := reflect.ValueOf(i) var isNil bool if v, isNil = indirect(v); isNil { - return nil, fmt.Errorf("index of nil pointer") + return nil, errors.New("index of nil pointer") } switch v.Kind() { case reflect.Array, reflect.Slice, reflect.String: @@ -1693,7 +1693,7 @@ func index(item interface{}, indices ...interface{}) (interface{}, error) { case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: x = int64(index.Uint()) case reflect.Invalid: - return nil, fmt.Errorf("cannot index slice/array with nil") + return nil, errors.New("cannot index slice/array with nil") default: return nil, fmt.Errorf("cannot index slice/array with type %s", index.Type()) } @@ -1974,7 +1974,7 @@ func querify(params ...interface{}) (string, error) { qs := url.Values{} vals, err := dictionary(params...) if err != nil { - return "", fmt.Errorf("querify keys must be strings") + return "", errors.New("querify keys must be strings") } for name, value := range vals { |