errs
Error analysis for Go projects
Analyze error handling patterns in Go code. Find unchecked errors, missing wraps, and error handling anti-patterns.
Features
- Find unchecked errors in Go code
- Detect missing error wrapping
- Identify error handling anti-patterns
- Structured JSON output
Install
go install github.com/hegner123/errs@latestThe Problem: Hidden error handling bugs
# Go requires explicit error handling, but mistakes slip through:
# - Errors assigned to _ silently
# - Missing error wrapping loses context
# - err == nil checks that should use errors.Is()
#
# Linters catch some, but not domain-specific patterns.Solution
$ errs --cli --dir ./pkg --ext .goOutput
{"issues":[{"file":"handler.go","line":34,"type":"unchecked_error","message":"error from db.Close() assigned to _"},{"file":"service.go","line":78,"type":"unwrapped_error","message":"error returned without context wrapping"}],"total":2,"by_type":{"unchecked_error":1,"unwrapped_error":1}}Comparison
| Metric | Value |
|---|---|
| Checks | Unchecked errors, missing wraps, anti-patterns |
| Language | Go-specific analysis |