-
-
Notifications
You must be signed in to change notification settings - Fork 652
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
better yaml parsing #1619
better yaml parsing #1619
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! It's way more clear now 🎉
(Nothing to see with this PR, but what is your taskd command ? 😄 ) |
Hey @vmaerten, it's just a function I have defined in my dotfiles that helps me out with development: taskd () {
pushd "$DEV/github.com/go-task/task" &> /dev/null
go build -o "$HOME/bin/taskd" ./cmd/task
res=$?
popd &> /dev/null
if [ $res -ne 0 ]
then
echo "\x1b[31mFailed to build taskd\x1b[0m"
return 1
fi
"$HOME/bin/taskd" "$@"
} Essentially, it will build the task binary, place it in my Sidenote: You might think "why not just use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d168cad
to
d6c7edb
Compare
I rebased to fix a conflict. |
@andreynering I did look into this while doing this PR, but those errors are created by the YAML lexer rather than the parser. This makes it a bit more difficult to intercept the errors as we don't have access to the This alternative library also exists which provides this kind of error handling out-of-the-box. However, it does not implement the same interfaces and would mean redoing all our unmarshalers which is a bit annoying. |
This PR greatly improves the error reporting of YAML issues by surfacing the real parsing errors from
yaml.v3
and providing a syntax highlighted snippet of the error and its location. It also provides a clickable link to the error location (if using a supported editor terminal like VSCode).Syntax highlighting is provided through chroma and I have added a custom theme that looks good for terminals that only support 8 colours.
Some examples: