Summary
Error messages in the CLI have awkward or redundant phrasing:
1. internal/gen/gen.go:32
return fmt.Errorf("error render template got error: %v", err)
Grammatically awkward and redundant ("error...got error"). Should be:
return fmt.Errorf("code generation failed: %w", err)
2. internal/gen/gen.go:27
return fmt.Errorf("error processing %s: %v", input, err)
Acceptable but uses %v instead of %w for error wrapping. Should be:
return fmt.Errorf("processing %s: %w", input, err)
3. internal/gen/generator.go:192
return fmt.Errorf("invalid interface %s: %w", iface.Name, iface.err)
This one is fine — shown for comparison of the preferred style.
Why
- Consistent error message style across the codebase
- Using
%w enables callers to use errors.Is/errors.As for programmatic error handling
- Removing redundant "error...error" phrasing makes logs easier to scan
Summary
Error messages in the CLI have awkward or redundant phrasing:
1.
internal/gen/gen.go:32Grammatically awkward and redundant ("error...got error"). Should be:
2.
internal/gen/gen.go:27Acceptable but uses
%vinstead of%wfor error wrapping. Should be:3.
internal/gen/generator.go:192This one is fine — shown for comparison of the preferred style.
Why
%wenables callers to useerrors.Is/errors.Asfor programmatic error handling