diff options
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go')
-rw-r--r-- | vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go index 8758462..ff1ef68 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go | |||
@@ -9,6 +9,8 @@ import ( | |||
9 | "strconv" | 9 | "strconv" |
10 | "strings" | 10 | "strings" |
11 | "time" | 11 | "time" |
12 | |||
13 | "github.com/aws/aws-sdk-go/private/protocol" | ||
12 | ) | 14 | ) |
13 | 15 | ||
14 | // UnmarshalXML deserializes an xml.Decoder into the container v. V | 16 | // UnmarshalXML deserializes an xml.Decoder into the container v. V |
@@ -52,9 +54,15 @@ func parse(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { | |||
52 | if t == "" { | 54 | if t == "" { |
53 | switch rtype.Kind() { | 55 | switch rtype.Kind() { |
54 | case reflect.Struct: | 56 | case reflect.Struct: |
55 | t = "structure" | 57 | // also it can't be a time object |
58 | if _, ok := r.Interface().(*time.Time); !ok { | ||
59 | t = "structure" | ||
60 | } | ||
56 | case reflect.Slice: | 61 | case reflect.Slice: |
57 | t = "list" | 62 | // also it can't be a byte slice |
63 | if _, ok := r.Interface().([]byte); !ok { | ||
64 | t = "list" | ||
65 | } | ||
58 | case reflect.Map: | 66 | case reflect.Map: |
59 | t = "map" | 67 | t = "map" |
60 | } | 68 | } |
@@ -247,8 +255,12 @@ func parseScalar(r reflect.Value, node *XMLNode, tag reflect.StructTag) error { | |||
247 | } | 255 | } |
248 | r.Set(reflect.ValueOf(&v)) | 256 | r.Set(reflect.ValueOf(&v)) |
249 | case *time.Time: | 257 | case *time.Time: |
250 | const ISO8601UTC = "2006-01-02T15:04:05Z" | 258 | format := tag.Get("timestampFormat") |
251 | t, err := time.Parse(ISO8601UTC, node.Text) | 259 | if len(format) == 0 { |
260 | format = protocol.ISO8601TimeFormatName | ||
261 | } | ||
262 | |||
263 | t, err := protocol.ParseTime(format, node.Text) | ||
252 | if err != nil { | 264 | if err != nil { |
253 | return err | 265 | return err |
254 | } | 266 | } |