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

chore: Upgrade yaml v3 #4172

Merged
merged 4 commits into from
Jan 25, 2024
Merged

Conversation

lukemassa
Copy link
Contributor

what

Upgrade gopkg.in/yaml from v2 to v3.

why

Keeping dependencies up to date.

This was built off of a failing renovate run. There are two issues to deal with upgrading from v2 to v3.

  1. UnmarshalStrict is no longer available (Support for Unmarshalling strict in yaml v3 go-yaml/yaml#602). You have to use Decode() with KnownFields set to true. Decode has slightly different semantics to Unmarshal (Reading empty file causes Decode to return error go-yaml/yaml#805), so I wrapped these calls in the unit tests. In the actual code I just write the full implementation out so it's more clear, but that would have been quite a bit of copy/paste for unit tests.
  2. There's a bug in yaml v3 where it doesn't parse empty elements in arrays properly (Reading empty file causes Decode to return error go-yaml/yaml#805). We were only doing this in unit tests, so I had to in a few places replace - with - {}.

tests

Unit tests

references

Obsoletes: #3974

@lukemassa lukemassa requested review from a team as code owners January 24, 2024 04:50
@lukemassa lukemassa requested review from GenPage, nitrocode and X-Guardian and removed request for a team January 24, 2024 04:50
@github-actions github-actions bot added dependencies PRs that update a dependency file go Pull requests that update Go code labels Jan 24, 2024
@lukemassa lukemassa changed the title Upgrade yaml v3 chore: Upgrade yaml v3 Jan 24, 2024
@GenPage GenPage added this to the v0.28.0 milestone Jan 24, 2024
@lukemassa lukemassa merged commit 34ef59d into runatlantis:main Jan 25, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies PRs that update a dependency file go Pull requests that update Go code
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

3 participants