Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanLonguet committed Oct 23, 2023
1 parent 4995a84 commit b916823
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
8 changes: 1 addition & 7 deletions internal/controllers/terraformlayer/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"sort"
"sync"
"time"

configv1alpha1 "github.com/padok-team/burrito/api/v1alpha1"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -83,11 +82,6 @@ func (r *Reconciler) getAllFinishedRuns(ctx context.Context, layer *configv1alph
return runs, nil
}

type runRetention struct {
plan time.Duration
apply time.Duration
}

func deleteAll(ctx context.Context, c client.Client, objs []*configv1alpha1.TerraformRun) error {
var wg sync.WaitGroup
errorCh := make(chan error, len(objs))
Expand Down Expand Up @@ -161,7 +155,7 @@ func sortAndSplitRunsByAction(runs []*configv1alpha1.TerraformRun) map[string][]
}
splittedRuns[run.Spec.Action] = append(splittedRuns[run.Spec.Action], run)
}
for action, _ := range splittedRuns {
for action := range splittedRuns {
sort.Slice(splittedRuns[action], func(i, j int) bool {
return splittedRuns[action][i].CreationTimestamp.Before(&splittedRuns[action][j].CreationTimestamp)
})
Expand Down
11 changes: 6 additions & 5 deletions internal/server/api/layers.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ func (a *API) isLayerRunning(layer configv1alpha1.TerraformLayer) bool {
log.Errorf("could not list terraform runs, returning false: %s", err)
return false
}
a.Client.List(context.Background(), runs)
err = a.Client.List(context.Background(), runs)
if err != nil {
log.Errorf("could not list terraform runs, returning false: %s", err)
return false
}
for _, r := range runs.Items {
if r.Status.State == "Running" {
return true
Expand All @@ -73,8 +77,5 @@ func (a *API) isLayerRunning(layer configv1alpha1.TerraformLayer) bool {
}

func (a *API) isLayerPR(layer configv1alpha1.TerraformLayer) bool {
if layer.OwnerReferences[0].Kind == "TerraformPullRequest" {
return true
}
return false
return layer.OwnerReferences[0].Kind == "TerraformPullRequest"
}
5 changes: 3 additions & 2 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ func (s *Server) Exec() {
if err != nil {
log.Fatalf("error initializing client: %s", err)
}
s.API.Client = *client
s.Webhook.Client = *client
s.client = *client
s.API.Client = s.client
s.Webhook.Client = s.client
log.Infof("starting burrito server...")
e := echo.New()
e.Use(middleware.Logger())
Expand Down

0 comments on commit b916823

Please sign in to comment.