Skip to content

Migrate from gopkg.in/yaml.v2 to go.yaml.in/yaml/v3 - #140

Open
justinhwang wants to merge 1 commit into
masterfrom
yaml-v3-migration
Open

justinhwang wants to merge 1 commit into
masterfrom
yaml-v3-migration

Conversation

@justinhwang

Copy link
Copy Markdown

Replace the YAML backend with go.yaml.in/yaml/v3 and adopt its behavior. Because v3 follows the YAML 1.2 core schema, several parsing behaviors change:

  • Only true/false (and their case variants) are Booleans; the YAML 1.1 spellings yes/no/on/off are now plain strings.
  • Duplicate keys are always rejected, even in permissive mode; keys with the same textual form (e.g. 2 and "2") count as duplicates.
  • Mappings are represented as map[string]any (v3's native type) instead of map[interface{}]interface{}; non-string scalar keys are rendered in canonical string form. Merged output is re-serialized by v3.

Also switch SetStrict to KnownFields, add merge.Normalize/StringifyKey to collapse v3's map shapes into map[string]any, and replace interface{} with any throughout.

These are backward-incompatible changes that warrant a v2.0.0 release (module path go.uber.org/config/v2), tracked separately.

Replace the YAML backend with go.yaml.in/yaml/v3 and adopt its behavior.
Because v3 follows the YAML 1.2 core schema, several parsing behaviors
change:

- Only true/false (and their case variants) are Booleans; the YAML 1.1
  spellings yes/no/on/off are now plain strings.
- Duplicate keys are always rejected, even in permissive mode; keys with
  the same textual form (e.g. 2 and "2") count as duplicates.
- Mappings are represented as map[string]any (v3's native type) instead
  of map[interface{}]interface{}; non-string scalar keys are rendered in
  canonical string form. Merged output is re-serialized by v3.

Also switch SetStrict to KnownFields, add merge.Normalize/StringifyKey to
collapse v3's map shapes into map[string]any, and replace interface{}
with any throughout.

These are backward-incompatible changes that warrant a v2.0.0 release
(module path go.uber.org/config/v2), tracked separately.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant