forked from mirror/cast
Fix issues found by gosimple
This commit is contained in:
parent
e71c5a68f1
commit
1dfd38810f
11
caste.go
11
caste.go
|
@ -340,11 +340,11 @@ func ToStringE(i interface{}) (string, error) {
|
||||||
case bool:
|
case bool:
|
||||||
return strconv.FormatBool(s), nil
|
return strconv.FormatBool(s), nil
|
||||||
case float64:
|
case float64:
|
||||||
return strconv.FormatFloat(i.(float64), 'f', -1, 64), nil
|
return strconv.FormatFloat(s, 'f', -1, 64), nil
|
||||||
case int64:
|
case int64:
|
||||||
return strconv.FormatInt(i.(int64), 10), nil
|
return strconv.FormatInt(s, 10), nil
|
||||||
case int:
|
case int:
|
||||||
return strconv.FormatInt(int64(i.(int)), 10), nil
|
return strconv.Itoa(s), nil
|
||||||
case []byte:
|
case []byte:
|
||||||
return string(s), nil
|
return string(s), nil
|
||||||
case template.HTML:
|
case template.HTML:
|
||||||
|
@ -506,10 +506,7 @@ func ToSliceE(i interface{}) ([]interface{}, error) {
|
||||||
|
|
||||||
switch v := i.(type) {
|
switch v := i.(type) {
|
||||||
case []interface{}:
|
case []interface{}:
|
||||||
for _, u := range v {
|
return append(s, v...), nil
|
||||||
s = append(s, u)
|
|
||||||
}
|
|
||||||
return s, nil
|
|
||||||
case []map[string]interface{}:
|
case []map[string]interface{}:
|
||||||
for _, u := range v {
|
for _, u := range v {
|
||||||
s = append(s, u)
|
s = append(s, u)
|
||||||
|
|
Loading…
Reference in New Issue