-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/encoding/yaml: decode empty inputs as "null"
The YAML 1.2.2 spec says: YAML allows the node content to be omitted in many cases. Nodes with empty content are interpreted as if they were plain scalars with an empty value. Such nodes are commonly resolved to a “null” value. And indeed, multiple of their examples show empty inputs decoding as null, such as --- --- # Empty ... resulting in two "null" values. The old YAML decoder seems to have wanted this behavior for years, but as my TODO on the new decoder explains, it returned a "null" literal alongside an io.EOF error, and the consumer discarded the literal. This resolves the mishandling of empty inputs, which reached io.EOF directly without providing any decoded CUE expression, and also resolves all panics that this caused in cmd/cue. Fixes #1790. Fixes #2714. Fixes #3337. Closes #1807. Signed-off-by: Daniel Martí <[email protected]> Change-Id: Iaa3356c7eee5e84dc51386a057a470138e1ac3ce Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198876 Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Roger Peppe <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
- Loading branch information
Showing
5 changed files
with
13 additions
and
14 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
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
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