From 0f0ea7e925b188f15676601ff575489059c4b4ad Mon Sep 17 00:00:00 2001 From: MDietermann Date: Mon, 13 Apr 2026 19:55:41 +0200 Subject: [PATCH] refactor(engine): remove dead failed map from markFailed --- internal/engine/engine.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/internal/engine/engine.go b/internal/engine/engine.go index 43c240d..3b4b0ac 100644 --- a/internal/engine/engine.go +++ b/internal/engine/engine.go @@ -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 }