Skip to content

Replace gopkg.in/yaml.v3 with github.com/goccy/go-yaml#1725

Closed
xqqp wants to merge 1 commit into
stretchr:masterfrom
xqqp:remove_go-yaml
Closed

Replace gopkg.in/yaml.v3 with github.com/goccy/go-yaml#1725
xqqp wants to merge 1 commit into
stretchr:masterfrom
xqqp:remove_go-yaml

Conversation

@xqqp
Copy link
Copy Markdown

@xqqp xqqp commented Apr 4, 2025

Summary

Replace gopkg.in/yaml with github.com/goccy/go-yaml. See #1724.
This was previously attempted in #1120, but the PR got closed due to go-yaml having a high number of dependencies. This has since been resolved. go-yaml does not have any dependencies anymore.

The only downside is that go-yaml requires at least golang v1.21

@xqqp xqqp force-pushed the remove_go-yaml branch from a02a4b0 to f6586e0 Compare April 4, 2025 21:20
@ccoVeille
Copy link
Copy Markdown
Collaborator

While I get the point, removing support for old Go versions is something that should be stated by maintainer @dolmen @brackendawson

@ccoVeille
Copy link
Copy Markdown
Collaborator

Another PR was opened to address this apparently

The kubernetes' yaml version doesn't imply to bump Go minimal version

@xqqp
Copy link
Copy Markdown
Author

xqqp commented Apr 15, 2025

I also considered the Kubernetes yaml fork, but this one still has the 8 year old gopkg.in/check.v1 dependency, while github.com/goccy/go-yaml does not.

@ccoVeille
Copy link
Copy Markdown
Collaborator

ccoVeille commented Apr 15, 2025

The tests are failing.

I would say let's wait for a go/no-go from @dolmen or @brackendawson to bump minimal Go version for testify.

I don't feel like there is an urge in fixing tests if your PR is declined because of the minimal Go version bump.

@dolmen dolmen added YAML About YAML and dependency dependencies Pull requests that update a dependency file labels Apr 22, 2025
@dolmen dolmen changed the title replace gopkg.in/yaml with github.com/goccy/go-yaml Replace gopkg.in/yaml.v3 with github.com/goccy/go-yaml Apr 22, 2025
@dolmen
Copy link
Copy Markdown
Collaborator

dolmen commented Apr 22, 2025

There is a major downside in any replacement: I expect that the new library doesn't have 100% identical behavior.

Instead replacement driven by the end user is already supported and documented: see package github.com/stretchr/testify/assert/yaml.

@ccoVeille
Copy link
Copy Markdown
Collaborator

Please note there is also https://github.com/yaml/go-yaml/ in preparation

It's a fork of gopkg.in/yaml made by the official YAML team

@brackendawson
Copy link
Copy Markdown
Collaborator

Given the discussion in #1724 I'm quite confident that we won't be moving to github.com/goccy/go-yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking Change dependencies Pull requests that update a dependency file YAML About YAML and dependency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants