You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using this library to develop actionlint. Since it is a linter, I want to know the exact source position of unmarshal error so that it can report exact error position with helpful source snippet.
Currently go-yaml/yaml's unmarshal error does not have source position information though line number is embedded in an error message.
Example usage is as follows:
package main
import (
"fmt""gopkg.in/yaml.v3"
)
funcmain() {
in:="#\n - - QI\xd7"varn yaml.Nodeiferr:=yaml.Unmarshal([]byte(in), &n); err!=nil {
err, _:=err.(*yaml.TypeError)
for_, err:=rangeerr.Errors {
// I want the err.Line and err.Column fieldsfmt.Fprintf("yaml parse failure at line:%d col:%d: %s\n", err.Line, err.Column, err.Message)
}
fmt.Fprintf("%d errors found while parsing yaml file\n", len(err.Errors))
}
}
The text was updated successfully, but these errors were encountered:
Hi,
I'm using this library to develop actionlint. Since it is a linter, I want to know the exact source position of unmarshal error so that it can report exact error position with helpful source snippet.
Currently go-yaml/yaml's unmarshal error does not have source position information though line number is embedded in an error message.
Example usage is as follows:
The text was updated successfully, but these errors were encountered: