Get the latest tech news
The Day the Linter Broke My Code
Series: Another Story… Imagine you were given a task to design errors for your service. DataEOFErrorshould contain the name of the data file and be considered equal to io.ErrUnexpectedEOF.
A well-intentioned linter suggestion turned a perfectly correct implementation into a subtle bug that broke Go’s error handling semantics. Our journey started with a seemingly helpful linter suggestion that broke our code by violating a fundamental principle of Go’s error handling: a custom Is method must perform a shallow, direct comparison. The linter’s automatic fix introduced a bug by applying a general rule without understanding the specific requirements of implementing the Is interface.
Or read this on Hacker News