goccy / go-yaml

YAML support for the Go language
MIT License
1.12k stars 129 forks source link

Unwanted int to float conversion #427

Open xsilas opened 6 months ago

xsilas commented 6 months ago

Describe the bug Using the Marshal function on a interface{} converts an integer to a float value despite the gopkg yamlv3 (gopkg.in/yaml.v3) does not: Port somehow turns into a float:

To Reproduce

yamlv3Bytes, err := yamlv3.Marshal(someInterface) if err != nil { return err } fmt.Println(string(yamlv3Bytes))

yamlBytes, err := yaml.Marshal(someInterface) if err != nil { return err } fmt.Println(string(yamlBytes))

Expected behavior Port should remain an int like so:

Screenshots Bildschirmfoto vom 2024-02-19 11-32-17

Version Variables

Additional context If theres a mistake / missunderstanding on my side please let me know