errs

Error analysis for Go projects

Go Development GitHub

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@latest

The 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 .go

Output

{"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

MetricValue
ChecksUnchecked errors, missing wraps, anti-patterns
LanguageGo-specific analysis