TLDR Web Dev · ARTICLES & TUTORIALS

UNDERSTANDING GO ERROR TYPES: POINTER VS. VALUE

blog.fillmore-labs.com8 min read

Summary from the TLDR Web Dev newsletter

When upgrading Go error handling to errors.As(), there's a dangerous bug where the function requires exact type matching between pointer vs. value types—if an error is returned as a value but checked as a pointer, the check silently fails without compilation errors. The solution is to use compile-time interface assertions to document intended usage and linters to enforce consistency, since these mismatches can bypass critical error handling in production.