yoheimuta / go-protoparser

Yet another Go package which parses a Protocol Buffer file (proto2+proto3)
MIT License
166 stars 20 forks source link

Remove internal errors for protolint to parse #47

Open PaulSonOfLars opened 4 years ago

PaulSonOfLars commented 4 years ago

Certain internal errors get thrown on parse issues, which makes it impossible to open a switch statement on them.

This PR removes those, instead returning the latest error, which seems to be the most relevant from the parse tests I ran.

Sample protolint output from previous errors: image

As you can see, both errors are very similar. In my opinion, the second one is slightly more helpful; hence why i return that one. They are both guaranteed to be non-nil given the previous if statements.