Skip to content

Commit

Permalink
fix detecting yaml timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
casualjim committed Aug 18, 2022
1 parent bf6952f commit 0579829
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ const ( // See https://yaml.org/type/
yamlIntScalar = "tag:yaml.org,2002:int"
yamlBoolScalar = "tag:yaml.org,2002:bool"
yamlFloatScalar = "tag:yaml.org,2002:float"
yamlTimestamp = "tag:yaml.org,2002:timestamp"
yamlNull = "tag:yaml.org,2002:null"
)

func yamlScalar(node *yaml.Node) (interface{}, error) {
Expand All @@ -142,9 +144,9 @@ func yamlScalar(node *yaml.Node) (interface{}, error) {
return nil, fmt.Errorf("unable to process scalar node. Got %q. Expecting float content: %w", node.Value, err)
}
return f, nil
case "yaml.org,2002:timestamp":
case yamlTimestamp:
return node.Value, nil
case "tag:yaml.org,2002:null":
case yamlNull:
return nil, nil
default:
return nil, fmt.Errorf("YAML tag %q is not supported", node.LongTag())
Expand Down

0 comments on commit 0579829

Please sign in to comment.