Skip to content

[Code Quality] Fix missing %w error wrapping in compiler_validators.go #46756

Description

@github-actions

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 ·

  • expires on Jul 20, 2026, 11:50 PM UTC-08:00

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions