Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ var unmarshalTests = []struct {
},
{
"a: 2015-02-24T18:19:39Z\n",
map[string]time.Time{"a": time.Unix(1424801979, 0)},
map[string]time.Time{"a": time.Unix(1424801979, 0).In(time.UTC)},
},

// Encode empty lists as zero-length slices.
Expand Down
12 changes: 9 additions & 3 deletions resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,15 @@ func resolve(tag string, in string) (rtag string, out interface{}) {
if err == nil {
return yaml_INT_TAG, uintv
}
floatv, err := strconv.ParseFloat(plain, 64)
if err == nil {
return yaml_FLOAT_TAG, floatv
tryFloat := true
if strings.HasPrefix(plain, "0") {
tryFloat = strings.ContainsRune(plain, '.')
}
if tryFloat {
floatv, err := strconv.ParseFloat(plain, 64)
if err == nil {
return yaml_FLOAT_TAG, floatv
}
}
if strings.HasPrefix(plain, "0b") {
intv, err := strconv.ParseInt(plain[2:], 2, 64)
Expand Down