Skip to content
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

Open
xsilas opened this issue Feb 19, 2024 · 0 comments
Open

Unwanted int to float conversion #427

xsilas opened this issue Feb 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@xsilas
Copy link

xsilas commented Feb 19, 2024

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:

  • docker:
    file: Dockerfile
    platform:
    • arch: amd64
      os: linux
    • arch: arm64
      os: linux
      ingresses:
    • host: www
      name: website
      ports:
    • 8080.0
      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:

  • docker:
    file: Dockerfile
    platform:
    - arch: amd64
    os: linux
    - arch: arm64
    os: linux
    ingresses:
    • host: www
      name: website
      ports:
    • 8080
      resources: {}
      user: "101"

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

Version Variables

  • Go version: 1.22
  • go-yaml's Version: v1.11.3

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

@xsilas xsilas added the bug Something isn't working label Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant