-
-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unwanted int to float conversion #427
Comments
@xsilas I think this depends on the type of |
Encountered this issue when trying to display epoch times. This contends to be the worst way to display such an integer. Google's yaml Marshal also has the same behavior, but their json Marshal does not.
|
I submitted a PR to fix this behavior, but it ran into your test suite failing for such things as rendering 1.0 as 1. Which to me is correct behavior, and is indeed correct for JSON but others disagree for YAML. But with YAML claiming to be a superset of JSON, I don't see how the behavior should differ. So I closed the PR and will use my fork instead. Here's the reverse issue on Google's library |
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:
file: Dockerfile
platform:
os: linux
os: linux
ingresses:
name: website
ports:
resources: {}
user: "101"
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:
file: Dockerfile
platform:
- arch: amd64
os: linux
- arch: arm64
os: linux
ingresses:
name: website
ports:
resources: {}
user: "101"
Screenshots
Version Variables
Additional context
If theres a mistake / missunderstanding on my side please let me know
The text was updated successfully, but these errors were encountered: