chore: migrate yaml to go.yaml.in/yaml/v3#362
Conversation
| var buf bytes.Buffer | ||
| encoder := yaml.NewEncoder(&buf) | ||
| if err := encoder.Encode(valueNode); err != nil { | ||
| return nil, fmt.Errorf("testfixtures: could not encode value: %w", err) | ||
| } | ||
|
|
||
| var records any | ||
| if err := yaml.Unmarshal(buf.Bytes(), &records); err != nil { | ||
| return nil, fmt.Errorf("testfixtures: could not unmarshal value: %w", err) | ||
| } |
There was a problem hiding this comment.
It might be a good idea to have a custom type to avoid this marshal/unmarshall process here.
|
Hi I'm one of the yaml/go-yaml maintainer I would like to suggest you to use the v3.0.4 version The main branch from where we created an -rc is moving fast, and we should have named it an alpha. |
|
@ccoVeille Good to know. I've been using the 4 RC version on many projects. "Release Candidate" usually means it practically the final version, so yes it's a bit confusing. |
|
I know 😅 We introduced something about new error struct around 4.0.0-rc2 that didn't meet or expectations. We have just found out it would be problem with the latest PR when we released the -rc4 It's not a big thing. But enough to question us about our choices. So here we are actively defining the best option. But if you are not relying on yaml error struct s you are safe to use the -rc4 |
|
@andreynering any reason to migrate from
@ccoVeille pls share your feedback, I guess you know both libraries |
| if node.Kind == yaml.DocumentNode && len(node.Content) > 0 { | ||
| node = *node.Content[0] | ||
| } |
There was a problem hiding this comment.
I think this would be unnecessary when this will be merged and released
|
As an anedotic story, we do advanced usage of YAML on Task and were never able to migrate to All that said, this is far from urgent. If v4 is alpha, we can hold this PR until that's more stable if we decide to. |
0ed90c6 to
3affaa7
Compare
go.yaml.in/yaml/v4go.yaml.in/yaml/v3
According to one of the maintainers, `go.yaml.in/yaml/v4` is still alpha and they called it "rc" by mistake. In fact, our dependency update PRs are failing because they're still pushing breaking changes to v4. * go-testfixtures/testfixtures#362 (comment) * #2661
go.yaml.in/yaml/v3is the new official YAML package maintained by the YAML org. This is a fork from the oldgopkg.in/yaml.v3has been unmaintained for a while.