Description
compiler.go has 7 bare return err calls and zero fmt.Errorf("%w") wraps, stripping all context from error paths through the main entry point. This makes debugging failures hard — the error reaches callers with no indication of which operation failed.
This was identified in the Daily Compiler Code Quality Report where compiler.go scored 67/100, with error handling being a key weakness (10/20).
Suggested Changes
- Replace all 7 bare
return err calls in compiler.go with return fmt.Errorf("<operation>: %w", err) patterns
- Each wrapping message should describe the operation being attempted at that call site
Files Affected
pkg/compiler/compiler.go (7 error return sites)
Success Criteria
grep -n 'return err$' pkg/compiler/compiler.go returns zero results
- All error paths include context via
fmt.Errorf("...: %w", err)
make fmt && make lint passes
- Existing tests continue to pass
Source
Extracted from [daily-compiler-quality] Daily Compiler Code Quality Report - 2026-07-15 (discussion #45594)
Priority
High (30 min effort) — minimal risk change with immediate improvement to error debuggability
🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · 204.4 AIC · ⌖ 5.13 AIC · ⊞ 7K · ◷
Description
compiler.gohas 7 barereturn errcalls and zerofmt.Errorf("%w")wraps, stripping all context from error paths through the main entry point. This makes debugging failures hard — the error reaches callers with no indication of which operation failed.This was identified in the Daily Compiler Code Quality Report where
compiler.goscored 67/100, with error handling being a key weakness (10/20).Suggested Changes
return errcalls incompiler.gowithreturn fmt.Errorf("<operation>: %w", err)patternsFiles Affected
pkg/compiler/compiler.go(7 error return sites)Success Criteria
grep -n 'return err$' pkg/compiler/compiler.goreturns zero resultsfmt.Errorf("...: %w", err)make fmt && make lintpassesSource
Extracted from [daily-compiler-quality] Daily Compiler Code Quality Report - 2026-07-15 (discussion #45594)
Priority
High (30 min effort) — minimal risk change with immediate improvement to error debuggability