From d3c0ca2c6c7b3d62eea8b909b9609f36ed1f2e28 Mon Sep 17 00:00:00 2001 From: Sebastien Blot Date: Mon, 18 Nov 2024 00:14:07 +0100 Subject: [PATCH] lint --- cmd/crowdsec-cli/clibouncer/delete.go | 15 +++++++-------- pkg/apiserver/api_key_test.go | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/cmd/crowdsec-cli/clibouncer/delete.go b/cmd/crowdsec-cli/clibouncer/delete.go index a931d1bce22..a752e215e36 100644 --- a/cmd/crowdsec-cli/clibouncer/delete.go +++ b/cmd/crowdsec-cli/clibouncer/delete.go @@ -47,15 +47,14 @@ func (cli *cliBouncers) delete(ctx context.Context, bouncers []string, ignoreMis } log.Warnf("bouncer '%s' is auto-created and cannot be deleted, delete parent bouncer %s instead", bouncerName, parentBouncer) continue - } else { - //Try to find all child bouncers and delete them - for _, childBouncer := range allBouncers { - if strings.HasPrefix(childBouncer.Name, bouncerName+"@") { - if err := cli.db.DeleteBouncer(ctx, childBouncer.Name); err != nil { - return fmt.Errorf("unable to delete bouncer: %w", err) - } - log.Infof("bouncer '%s' deleted successfully", childBouncer.Name) + } + //Try to find all child bouncers and delete them + for _, childBouncer := range allBouncers { + if strings.HasPrefix(childBouncer.Name, bouncerName+"@") { + if err := cli.db.DeleteBouncer(ctx, childBouncer.Name); err != nil { + return fmt.Errorf("unable to delete bouncer: %w", err) } + log.Infof("bouncer '%s' deleted successfully", childBouncer.Name) } } diff --git a/pkg/apiserver/api_key_test.go b/pkg/apiserver/api_key_test.go index 48d10b48a8f..45c02c806e7 100644 --- a/pkg/apiserver/api_key_test.go +++ b/pkg/apiserver/api_key_test.go @@ -88,6 +88,6 @@ func TestAPIKey(t *testing.T) { assert.Equal(t, "test@4.3.2.1", bouncers[1].Name) assert.Equal(t, bouncers[0].APIKey, bouncers[1].APIKey) assert.Equal(t, bouncers[0].AuthType, bouncers[1].AuthType) - assert.Equal(t, bouncers[0].AutoCreated, false) - assert.Equal(t, bouncers[1].AutoCreated, true) + assert.False(t, bouncers[0].AutoCreated) + assert.True(t, bouncers[1].AutoCreated) }