itchyny / gojq

Pure Go implementation of jq
MIT License
3.3k stars 119 forks source link

avoid issues when handling errors #251

Open ccoVeille opened 7 months ago

ccoVeille commented 7 months ago
ccoVeille commented 7 months ago

This is a draft as I need to check every single changes I made to respect what you said here https://github.com/itchyny/gojq/pull/249#issuecomment-2038445048

ccoVeille commented 7 months ago

Here is a new version where I only used errors.Is/errors.As for external errors.

I followed your recommendation

This is meaningless change applying unthoughtful best practices. The errors are controlled in the package and errors.Is is reasonable only when the error comes from another package, also I don't like for performance reasons. Return statement in else is intentional, not to catch unexpected failure of forgetting return in previous branches, possibly caused by nested branches. The first commit about useless receivers is the only one I can merge in the changes.