refactor: migrate from gopkg.in/yaml to go.yaml.in/yaml/v4#2704
Merged
markphelps merged 4 commits intomainfrom Feb 9, 2026
Merged
refactor: migrate from gopkg.in/yaml to go.yaml.in/yaml/v4#2704markphelps merged 4 commits intomainfrom
markphelps merged 4 commits intomainfrom
Conversation
Replace unmaintained gopkg.in/yaml.v2 and yaml.v3 with the official YAML organization's maintained fork at go.yaml.in/yaml/v4. Changes: - Update all imports from gopkg.in/yaml.v2/v3 to go.yaml.in/yaml/v4 - Fix type assertions in UnmarshalYAML: map[any]any -> map[string]any (yaml v4 returns map[string]any for mappings, not map[any]any) - Update test expectation for yaml.Marshal indentation (v4 uses 4-space indentation by default) - Simplify overwrite_yaml.go using Go 1.21+ builtins (max, range int) The go.yaml.in/yaml/v4 library is maintained by the official YAML organization after go-yaml was marked unmaintained in April 2025.
Apply automated modernizer fixes across the codebase: - Use modern Go idioms and builtins (e.g., slices package, range int) - Simplify error handling patterns - Clean up redundant code
Enable the 'modernize' linter in golangci-lint to automatically catch code that can be simplified using modern Go language and library features. This will flag opportunities to use: - Range over integers (Go 1.22+) - slices/maps package functions - Other modern Go idioms
Signed-off-by: Mark Phelps <[email protected]>
michaeldwan
approved these changes
Feb 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gopkg.in/yaml.v2andyaml.v3with the official YAML organization's maintained fork atgo.yaml.in/yaml/v4modernizelinter to golangci-lint CI checksYAML Migration Changes
gopkg.in/yaml.v2/v3togo.yaml.in/yaml/v4UnmarshalYAML:map[any]any->map[string]any(yaml v4 returnsmap[string]anyfor mappings)yaml.Marshalindentation (v4 uses 4-space indentation by default)Modernizer Changes
slicespackage,range int)CI Changes
modernizelinter to.golangci.yamlto catch future modernization opportunities automaticallyReference