diff --git a/cmd/cloudexec/clean.go b/cmd/cloudexec/clean.go index c60047b..b000d42 100644 --- a/cmd/cloudexec/clean.go +++ b/cmd/cloudexec/clean.go @@ -44,7 +44,7 @@ func ConfirmDeleteDroplets(config config.Config, dropletName string, instanceToJ if err != nil { return confirmedToDelete, fmt.Errorf("Failed to destroy droplet: %w", err) } - confirmedToDelete = append(confirmedToDelete, instance.ID) + confirmedToDelete = append(confirmedToDelete, instance.ID) } } } else { diff --git a/cmd/cloudexec/main.go b/cmd/cloudexec/main.go index 2030513..34ac123 100644 --- a/cmd/cloudexec/main.go +++ b/cmd/cloudexec/main.go @@ -210,14 +210,14 @@ func main() { return err } - // deletes droplets per user feedback & returns a list of job IDs for state updates - confirmedToDelete, err := ConfirmDeleteDroplets(config, dropletName, instanceToJobs) + // deletes droplets per user feedback & returns a list of job IDs for state updates + confirmedToDelete, err := ConfirmDeleteDroplets(config, dropletName, instanceToJobs) if err != nil { return err } - if (len(confirmedToDelete) == 0) { - return nil - } + if len(confirmedToDelete) == 0 { + return nil + } existingState, err := state.GetState(config, bucketName) if err != nil { @@ -264,16 +264,16 @@ func main() { if err != nil { return err } - confirmedToDelete, err := ConfirmDeleteDroplets(config, dropletName, instanceToJobs) + confirmedToDelete, err := ConfirmDeleteDroplets(config, dropletName, instanceToJobs) if err != nil { return err } - if (len(confirmedToDelete) > 0) { - err = ssh.DeleteSSHConfig(user, "cloudexec") - if err != nil { - return err - } - } + if len(confirmedToDelete) > 0 { + err = ssh.DeleteSSHConfig(user, "cloudexec") + if err != nil { + return err + } + } return nil }, }, @@ -487,7 +487,7 @@ func main() { if err != nil { return err } - // If we got a job Id, get that job's state, else continue + // If we got a job Id, get that job's state, else continue latestJob := existingState.GetLatestJob() jobStatus := latestJob.Status diff --git a/pkg/state/state.go b/pkg/state/state.go index 940fcfc..34d76fc 100644 --- a/pkg/state/state.go +++ b/pkg/state/state.go @@ -182,13 +182,13 @@ func (s *State) CancelRunningJobs(config config.Config, bucketName string, toCan // Mark any running jobs as cancelled for i, job := range s.Jobs { if job.Status == Running || job.Status == Provisioning { - for _, id := range toCancel { - if id == job.ID { - fmt.Printf("Setting status of job %d to 'Cancelled'\n", job.ID) - s.Jobs[i].Status = Cancelled - break - } - } + for _, id := range toCancel { + if id == job.ID { + fmt.Printf("Setting status of job %d to 'Cancelled'\n", job.ID) + s.Jobs[i].Status = Cancelled + break + } + } } }