Hacker Newsnew | past | comments | ask | show | jobs | submit | eik's commentslogin


Announcement of the release of errortype v0.0.5, a Go linter that helps catch subtle bugs in error handling.

https://github.com/fillmore-labs/errortype#errortype


Yes, but “an Is method should only shallowly compare err and the target and not call Unwrap on either”:

https://pkg.go.dev/errors#Is


The linter in the post is `err113`. `errortype` does already warn:

https://github.com/fillmore-labs/errortype#errortype


Ah right, wrong linter. Thanks for confirming!


Having looked at the problems that can arise with errors.As:

https://news.ycombinator.com/item?id=44959638

Let's now look at how errors.Is can introduce subtle bugs that can affect the reliability of error checking, especially when trying to determine the root cause of an error.

How one letter can make such a difference…


I recently dove deep into an unexpectedly tricky issue in Go error handling — how using errors.As with pointers vs. values can silently change program behavior, and I wanted to share what I learned.

The Blog Post

I walk through the core mechanics, point out how the dynamic type (pointer vs. value) matters, and offer a simple, effective two-step approach to prevent these silent bugs.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: