From 1dfd38810f577b1a26a92bb6d02c422cdb29ed74 Mon Sep 17 00:00:00 2001 From: Cameron Moore Date: Fri, 3 Mar 2017 10:27:06 -0600 Subject: [PATCH] Fix issues found by gosimple --- caste.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/caste.go b/caste.go index 00ef65a..8d70d13 100644 --- a/caste.go +++ b/caste.go @@ -340,11 +340,11 @@ func ToStringE(i interface{}) (string, error) { case bool: return strconv.FormatBool(s), nil case float64: - return strconv.FormatFloat(i.(float64), 'f', -1, 64), nil + return strconv.FormatFloat(s, 'f', -1, 64), nil case int64: - return strconv.FormatInt(i.(int64), 10), nil + return strconv.FormatInt(s, 10), nil case int: - return strconv.FormatInt(int64(i.(int)), 10), nil + return strconv.Itoa(s), nil case []byte: return string(s), nil case template.HTML: @@ -506,10 +506,7 @@ func ToSliceE(i interface{}) ([]interface{}, error) { switch v := i.(type) { case []interface{}: - for _, u := range v { - s = append(s, u) - } - return s, nil + return append(s, v...), nil case []map[string]interface{}: for _, u := range v { s = append(s, u)