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

blank lines do not round-trip #627

Closed
bboreham opened this issue Jun 14, 2020 · 8 comments
Closed

blank lines do not round-trip #627

bboreham opened this issue Jun 14, 2020 · 8 comments

Comments

@bboreham
Copy link

I guess this is intentional since there's nowhere in the Node structure to store them, but I think it's good to have this noted as an issue.

package main

import (
        "fmt"

        "gopkg.in/yaml.v3"
)

var data = `
a: Easy!

b:
  c: 2
`

func main() {
        t := yaml.Node{}
        _ = yaml.Unmarshal([]byte(data), &t)
        d, _ := yaml.Marshal(&t)
        fmt.Printf("%s\n", string(d))
}
a: Easy!
b:
    c: 2

https://play.golang.org/p/Wc5wR4CO10I

@niemeyer
Copy link
Contributor

Done with eeeca48.

@aakrem
Copy link

aakrem commented Jul 24, 2020

can't we add something like blanklines-till-the-next-node? and add it to the node structure ??
Would be nice to reopen this issue

@mikefarah
Copy link

This has not been fixed...the provided example in the issue still has it's newlines stripped..

That or it has regressed? @niemeyer

@mikefarah
Copy link

oh just saw that the commit is a comment and not a fix - my bad

@omerozery
Copy link

everyone is just OK with that ?

@bboreham
Copy link
Author

bboreham commented Mar 1, 2021

Everyone is very grateful to have such high-quality software freely available.

@andry81
Copy link

andry81 commented Jul 29, 2022

Go programmers just go out of chat. :/

@ricosega
Copy link

shouldn't this be reopened?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants