Description
compiler_validators.go uses formatCompilerError for error formatting but never uses fmt.Errorf("%w", ...) for wrapping. This diverges from the established codebase convention of using %w to preserve error chains for upstream inspection (e.g. with errors.Is / errors.As).
This was flagged in the Daily Compiler Code Quality report which otherwise scores this file 83/100 (Good).
Suggested Changes
- Audit all error returns in
compiler_validators.go (426 lines, 15 functions)
- Replace bare
fmt.Errorf("...: " + err.Error()) or similar non-wrapping patterns with fmt.Errorf("...: %w", err)
- Where
formatCompilerError is used as a final presentation layer, consider whether it should also wrap the underlying cause
- Ensure
errors.Is / errors.As chains work for callers who need to inspect specific error types
Files Affected
pkg/compiler/compiler_validators.go (426 lines)
Success Criteria
- All error wrapping in
compiler_validators.go uses %w consistent with codebase convention
- Existing tests still pass (
make test)
go vet reports no issues
Source
Extracted from [daily-compiler-quality] Daily Compiler Code Quality Report - 2026-07-20
Priority
Medium — maintainability improvement; makes error chains inspectable by callers
🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · 44.8 AIC · ⌖ 7.87 AIC · ⊞ 7K · ◷
Description
compiler_validators.gousesformatCompilerErrorfor error formatting but never usesfmt.Errorf("%w", ...)for wrapping. This diverges from the established codebase convention of using%wto preserve error chains for upstream inspection (e.g. witherrors.Is/errors.As).This was flagged in the Daily Compiler Code Quality report which otherwise scores this file 83/100 (Good).
Suggested Changes
compiler_validators.go(426 lines, 15 functions)fmt.Errorf("...: " + err.Error())or similar non-wrapping patterns withfmt.Errorf("...: %w", err)formatCompilerErroris used as a final presentation layer, consider whether it should also wrap the underlying causeerrors.Is/errors.Aschains work for callers who need to inspect specific error typesFiles Affected
pkg/compiler/compiler_validators.go(426 lines)Success Criteria
compiler_validators.gouses%wconsistent with codebase conventionmake test)go vetreports no issuesSource
Extracted from [daily-compiler-quality] Daily Compiler Code Quality Report - 2026-07-20
Priority
Medium — maintainability improvement; makes error chains inspectable by callers