-
-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments in YAML break annotated source #254
Labels
bug
Something isn't working
Comments
Here's a tighter example of the miscounting/bad re-render: package main
import (
"fmt"
"github.com/goccy/go-yaml"
)
func main() {
src := (`
# This is my document
doc:
# This comment should be line 3
line:
# And below should be line 5
- five
- six
end: seven
`)
path, _ := yaml.PathString("$.doc.line[0]")
msg, _ := path.AnnotateSource([]byte(src), true)
fmt.Println(string(msg))
} |
Removing the leading newline in the func main() {
src := (`# This is my document
doc:
# This comment should be line 3
line:
# And below should be line 5
- five
- six
end: seven
`)
path, _ := yaml.PathString("$.doc.line[0]")
msg, _ := path.AnnotateSource([]byte(src), true)
fmt.Println(string(msg))
} |
Thank you for the detailed report. I'll try to investigate this problem . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or at least it seems like the comments are causing issue.
Here's a minimal reproduction:
And here's a screenshot of the output on
OS X go 1.17 github.com/goccy/go-yaml v1.9.3
:The text was updated successfully, but these errors were encountered: