You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Code Quality] Replace AuditComparisonIntDelta/StringDelta with generic Delta[T] type #46001
pkg/cli/audit_comparison.go defines two near-identical structs — AuditComparisonIntDelta (line 45) and AuditComparisonStringDelta (line 51) — that share the same {Before, After, Changed} shape. The only difference is the element type (int vs string). This is a textbook case for a Go generic type.
Suggested Changes
typeDelta[Tany] struct {
BeforeT`json:"before"`AfterT`json:"after"`Changedbool`json:"changed"`
}
// type AuditComparisonIntDelta = Delta[int]// type AuditComparisonStringDelta = Delta[string]
Define a single Delta[T any] struct in pkg/cli/audit_comparison.go
Replace both existing structs with type aliases or update all usages to use Delta[int] / Delta[string] directly
The generic type trivially extends to Delta[float64] or other types for future needs
Files Affected
pkg/cli/audit_comparison.go (lines 45-60, replace two structs with single generic)
Any files in pkg/cli/ that reference AuditComparisonIntDelta or AuditComparisonStringDelta
Success Criteria
Single Delta[T any] generic type defined
Both old concrete types removed or made type aliases
All existing usages compile correctly
make fmt && make golint-custom && go test ./pkg/cli/... passes
Activity
github-actions commentedon Jul 17, 2026
This issue was automatically closed because it expired on 2026-07-17T13:23:14.851Z.