redraskal / r6-dissect

Match Replay API/CLI for Rainbow Six: Siege's Dissect (.rec) format.
MIT License
68 stars 12 forks source link

fix: use errors.Is for error type assertion #25

Closed stnokott closed 1 year ago

stnokott commented 1 year ago

Tiny fix:

Comparing errors with == is bug-prone as it doesn't return true if the checked error type is wrapped in the error (e.g. by using fmt.Errorf with %w). The recommended way to assert error type assertion is using errors.Is.

See also the official error value FAQ.

Note: since neither the io nor the zstd library seem to return wrapped errors, it's not an issue in your usecase, but maybe it will be in the future 😉