Repository navigation
Conversation
On the root Data mapping only, the walker now treats files as a deprecated alias of lists, matching the key case-insensitively. When lists is absent, the key is renamed to lists and a warning is logged so Decode fills Data.Lists; when both are present and files is an empty mapping, an empty sequence, or a null scalar, that pair is removed and lists is kept, with a warning. A non-empty files value beside lists is left in place so the unknown-field error still fires. The name stays off the struct and out of the key lookup so a later save does not write it back, and nested mappings and other unknown root keys remain under the strict check. Fixes almeidapaulopt#512
This branch has not been deployed
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.
On the root Data mapping only, the walker now treats files as a deprecated alias of lists, matching the key case-insensitively. When lists is absent, the key is renamed to lists and a warning is logged so Decode fills Data.Lists; when both are present and files is an empty mapping, an empty sequence, or a null scalar, that pair is removed and lists is kept, with a warning. A non-empty files value beside lists is left in place so the unknown-field error still fires. The name stays off the struct and out of the key lookup so a later save does not write it back, and nested mappings and other unknown root keys remain under the strict check. Configs written by v1 and v2 still contain a root key named files, often the empty mapping those releases generated. v3 refuses to start and exits with an unknown-field error that names files and suggests lists, so an upgrade crash-loops until that key is removed by hand. The provider now lives on Data as lists, and the YAML walker rejects any key that is not a field of the struct being decoded. files was still present when unknown keys were collected, so the loader never renamed it and never decoded its value into Data.Lists.
Testing: Gofmt -l reports no unformatted files among the edited sources. go vet reports no issues for the config package.
Fixes #512