goccy / go-yaml

YAML support for the Go language
MIT License
1.12k stars 129 forks source link

Unmarshal drops lines and does not return error #459

Open jdistler opened 2 months ago

jdistler commented 2 months ago

Describe the bug When unmarshalling yaml files with certain kinds of whitespace errors, an error is not returned and all content after the whitespace error is truncated.

To Reproduce

https://go.dev/play/p/WgvHk09B-Px

Expected behavior

The expected behavior is that at err := yaml.Unmarshal(originalData, &content);, we return a non-nil error since we could not parse the entire file.

Screenshots

Let's say we have a yaml file with these contents:

formatVersion: 1
name: some name
description: |
  some description
continuing the description without proper whitespace
system: some system
source: snowflake

This is most definitely invalid yaml -

Screenshot 2024-07-01 at 1 53 43 PM

Screenshot 2024-07-01 at 1 53 54 PM

Version Variables