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

Marshalling bug because func (n *MappingValueNode) toString() Doesn't have case for tag nodes. #533

Open
jbutA opened this issue Nov 13, 2024 · 1 comment
Labels
encoder enhancement New feature or request

Comments

@jbutA
Copy link

jbutA commented Nov 13, 2024

Describe the bug
Local tags for scalar nodes are placed on a new line because toString() for MappingValueNode doesn't have a case for when .value is TagNode

To Reproduce
https://go.dev/play/p/6_AgHpB8WFs

Expected behavior
Relates to function at line 1355 in

func (n *MappingValueNode) toString() string {

If toString() had a case for TagNode and returned
return fmt.Sprintf("%s%s: %s", space, n.Key.String(), n.Value.String())
(no new line in format string) for when

_, ok := n.Value.(*TagNode); ok

then the node would be marshalled correctly.

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

Version Variables

  • Go version: 1.23
  • go-yaml's Version: 1.14.0

Additional context
Add any other context about the problem here.

@jbutA jbutA added the bug Something isn't working label Nov 13, 2024
@goccy goccy added duplicate This issue or pull request already exists and removed duplicate This issue or pull request already exists labels Nov 13, 2024
@goccy
Copy link
Owner

goccy commented Nov 13, 2024

ref #401

@goccy goccy added enhancement New feature or request encoder and removed bug Something isn't working labels Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
encoder enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants