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

Comments in a SequenceNode are removed when adding a new element to the SequenceNode #502

Open
suzuki-shunsuke opened this issue Nov 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@suzuki-shunsuke
Copy link

Describe the bug
A clear and concise description of what the bug is.

I want to append a new element to a SequenceNode keeping comments.
I could append a new element but comments in the SequenceNode were removed.

To Reproduce

Please provide a minimum yaml content that can be reproduced.
We are more than happy to use Go Playground

https://go.dev/play/p/27cMKnuAVKM

Expected behavior
A clear and concise description of what you expected to happen.

Original YAML:

packages:
  - foo
  # hello
  - bar

I want to append a new element to the packages keeping the comment # hello.

packages:
  - foo
  # hello
  - bar
  - zoo

But actually the comment was removed.

packages:
  - foo
  - bar
  - zoo

Screenshots
If applicable, add screenshots to help explain your problem.

Version Variables

  • Go version: [e.g. 1.21 ] 1.23.2
  • go-yaml's Version: [e.g. v1.11.1 ] 1.13.3

Additional context
Add any other context about the problem here.

@suzuki-shunsuke suzuki-shunsuke added the bug Something isn't working label Nov 3, 2024
@suzuki-shunsuke suzuki-shunsuke changed the title Can't add an element to SequenceNode keeping comments Comments in a SequenceNode are removed when adding a new element to the SequenceNode Nov 3, 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