1
0
mirror of https://github.com/rancher/norman.git synced 2025-08-31 14:51:57 +00:00

Revert "Don't strip strings on output"

This reverts commit 5e344d90cd.
Tested this and it broke more scenarios
This commit is contained in:
Craig Jellick
2018-08-17 14:19:14 -07:00
committed by Alena Prokharchyk
parent 316a8acc04
commit 4bcc025ae3
2 changed files with 2 additions and 9 deletions

View File

@@ -330,9 +330,6 @@ func ConvertSimple(fieldType string, value interface{}, op Operation) (interface
case "password":
return convert.ToString(value), nil
case "string":
if op.IsList() {
return convert.ToStringNoTrim(value), nil
}
return convert.ToString(value), nil
case "dnsLabel":
str := convert.ToString(value)

View File

@@ -44,7 +44,7 @@ func Singular(value interface{}) interface{} {
return value
}
func ToStringNoTrim(value interface{}) string {
func ToString(value interface{}) string {
if t, ok := value.(time.Time); ok {
return t.Format(time.RFC3339)
}
@@ -52,11 +52,7 @@ func ToStringNoTrim(value interface{}) string {
if single == nil {
return ""
}
return fmt.Sprint(single)
}
func ToString(value interface{}) string {
return strings.TrimSpace(ToStringNoTrim(value))
return strings.TrimSpace(fmt.Sprint(single))
}
func ToTimestamp(value interface{}) (int64, error) {