Erik Engheim
Jun 18, 2022

--

No, you don't have to compare it directly. errors.Is works fine. They are just remarking on the fact that internally they wrote the code using ==, presumably because errors.Is did not exist when they wrote it.

You can still write errors.Is, but you don't have to in the case of errors.EOF because Go 1.x is guranteed to not wrap EOF to retain backwards compatibility.

However you yourself are free to do so in your packages. Hence I think errors.Is is probably a good habit to get into anyway.

Thanks for the link though, I didn't know about this.

--

--

Erik Engheim
Erik Engheim

Written by Erik Engheim

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.

No responses yet