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

character '-' as string is interpreted as the beginning of a list #472

Open
Diliz opened this issue Sep 16, 2024 · 0 comments
Open

character '-' as string is interpreted as the beginning of a list #472

Diliz opened this issue Sep 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Diliz
Copy link

Diliz commented Sep 16, 2024

Describe the bug

When the value of an attribute is "-", what's next of this attribute seems to be rendered as a part of a list, which is not the case.

To Reproduce
Use the following yaml:

cat: -
dog: -
bark: "woof"

Unmarshaling then encoding it will be rendered as:

cat:
  - dog:
    - bark: "woof"

Here an example: https://go.dev/play/p/4IazOu5k7YA

Expected behavior

This should be rendered as:

cat: "-"
dog: "-"
bark: "woof"

Version Variables

  • Go version: 1.22
  • go-yaml's Version: 1.12.0
@Diliz Diliz added the bug Something isn't working label Sep 16, 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