-
-
Notifications
You must be signed in to change notification settings - Fork 530
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
decode: expand test and mark fields decoded recursively
This commit expands the test `TestDecodeCustomStructMarkedDecoded` so that nested data is also tested (thanks to Martin Tournoij). This lead to an update of the code to also mark all nested keys as decoded when a custom `UnmarshalTOML(data any)` interface is used. It is the job of the implemenator of the UnmarshalTOML() to ensure everything is decoded. An alternative would be to provide a new `UnmarshalTOMLWithMetadata(data any, md *MetaData)` inteface that would allow the implementaor of the custom unmarshaller to mark fields as decoded. But it's unclear if that is needed because a UnmarshalTOML() can already error if it "sees" unexpected or missing data.
- Loading branch information
Showing
2 changed files
with
42 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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