refactor(engine): remove dead failed map from markFailed

This commit is contained in:
MDietermann
2026-04-13 19:55:41 +02:00
parent 94c7084ec3
commit 0f0ea7e925

View File

@@ -80,7 +80,6 @@ func Run(ctx context.Context, reg *module.Registry, opts RunOptions) (Summary, e
}
results := make(map[string]*ModuleResult, len(mods))
failed := make(map[string]bool)
skipped := make(map[string]bool)
for _, id := range order {
@@ -96,7 +95,7 @@ func Run(ctx context.Context, reg *module.Registry, opts RunOptions) (Summary, e
if err != nil {
res.Status = StatusFailed
res.Err = fmt.Errorf("detect: %w", err)
markFailed(metas, id, failed, skipped)
markFailed(metas, id, skipped)
if opts.HaltOnError {
break
}
@@ -107,7 +106,7 @@ func Run(ctx context.Context, reg *module.Registry, opts RunOptions) (Summary, e
if err != nil {
res.Status = StatusFailed
res.Err = fmt.Errorf("plan: %w", err)
markFailed(metas, id, failed, skipped)
markFailed(metas, id, skipped)
if opts.HaltOnError {
break
}
@@ -123,7 +122,7 @@ func Run(ctx context.Context, reg *module.Registry, opts RunOptions) (Summary, e
if err := m.Apply(ctx, plan, opts.Reporter); err != nil {
res.Status = StatusFailed
res.Err = fmt.Errorf("apply: %w", err)
markFailed(metas, id, failed, skipped)
markFailed(metas, id, skipped)
if opts.HaltOnError {
break
}
@@ -132,7 +131,7 @@ func Run(ctx context.Context, reg *module.Registry, opts RunOptions) (Summary, e
if err := m.Verify(ctx); err != nil {
res.Status = StatusFailed
res.Err = fmt.Errorf("verify: %w", err)
markFailed(metas, id, failed, skipped)
markFailed(metas, id, skipped)
if opts.HaltOnError {
break
}
@@ -172,8 +171,7 @@ func resolveSelection(reg *module.Registry, selected []string) ([]module.Module,
return out, nil
}
func markFailed(metas []module.Meta, id string, failed, skipped map[string]bool) {
failed[id] = true
func markFailed(metas []module.Meta, id string, skipped map[string]bool) {
for d := range Descendants(metas, id) {
skipped[d] = true
}