diff --git a/helper/multistep/if.go b/helper/multistep/if.go index f485c50dc..f9705af62 100644 --- a/helper/multistep/if.go +++ b/helper/multistep/if.go @@ -3,7 +3,7 @@ package multistep // if returns step only if on is true. func If(on bool, step Step) Step { if on == false { - return nil + return &nullStep{} } return step } diff --git a/helper/multistep/multistep.go b/helper/multistep/multistep.go index a4629bacf..a3e427c0c 100644 --- a/helper/multistep/multistep.go +++ b/helper/multistep/multistep.go @@ -61,3 +61,11 @@ type Runner interface { // Run runs the steps with the given initial state. Run(context.Context, StateBag) } + +type nullStep struct{} + +func (s nullStep) Run(ctx context.Context, state StateBag) StepAction { + return ActionContinue +} + +func (s nullStep) Cleanup(state StateBag) {}