goccy / go-yaml

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

YaML path '$' fails with `failed to find path ( $ )` #428

Open wjam opened 6 months ago

wjam commented 6 months ago

Describe the bug Attempting to build a YaML path that points to the root of the YaML document (so just $) fails. The errors in the stack of errors are failed to read node, failed to filter from ast.File, failed to find path ( $ ), and node not found.

To Reproduce

Example failure - https://go.dev/play/p/UHfjmW_lYLf

Expected behavior A path is created that points to the root of the YaML document. Alternatively, the YaML path should be treated as invalid when attempting to create it.

Version Variables

nieomylnieja commented 5 months ago

There's an easy enough fix for that: https://github.com/nieomylnieja/go-yaml/commit/0e9c52f588e6f2df9b9b93255e664304ebc93925.

I'm not sure if this project is actively maintained anymore though, I'm using a fork myself.