TLDR Dev · LAUNCHES & TOOLS

GO PROPOSAL: TYPE-SAFE ERROR CHECKING

antonz.org4 min read

Summary from the TLDR Dev newsletter

The new errors.AsType function in Go is a generic version of errors that is type-safe, faster, and easier to use. errors.As has not been deprecated yet, but errors.AsType is recommended for new code. AsType can handle everything that As does, so it's a drop-in improvement for new code. Code examples are available in the article.