Brush all the lint off this code I wrote in a haze

This commit is contained in:
Erin Call
2019-12-09 10:52:41 -08:00
parent e3051ec72e
commit 8d66036252
11 changed files with 47 additions and 21 deletions

View File

@@ -5,14 +5,17 @@ import (
"github.com/pelotech/drone-helm3/internal/run"
)
// A Step is one step in the plan.
type Step interface {
Run() error
}
// A Plan is a series of steps to perform.
type Plan struct {
steps []Step
}
// NewPlan makes a plan for running a helm operation.
func NewPlan(cfg Config) (*Plan, error) {
p := Plan{}
switch cfg.Command {
@@ -44,6 +47,7 @@ func NewPlan(cfg Config) (*Plan, error) {
return &p, nil
}
// Execute runs each step in the plan, aborting and reporting on error
func (p *Plan) Execute() error {
for _, step := range p.steps {
if err := step.Run(); err != nil {