Skip to content

Unmarshal loses type information #45

@philomory

Description

@philomory

When unmarshalling a YAML file to a map[string]interface{}, all integer values are converted to float64 values instead, despite the fact that both YAML and Go support integer values. This is presumably due to the way the package goes from YAML to JSON before finally unmarshalling to "real" Go types, with JSON only having float numeric types.

For an example of this problem in action (and a comparison to gopkg.in/yaml.v2, which does not exhibit this issue) see https://play.golang.org/p/YfO69Z3vi-V.

This is particularly notable when Helm is unmarshalling values.yaml. For an example of that, see helm/helm#8978 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.priority/backlogHigher priority than priority/awaiting-more-evidence.sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions