diff --git a/internal/cmd/firewall/delete_rule.go b/internal/cmd/firewall/delete_rule.go index 69577e49..52df4fa0 100644 --- a/internal/cmd/firewall/delete_rule.go +++ b/internal/cmd/firewall/delete_rule.go @@ -105,7 +105,7 @@ var DeleteRuleCmd = base.Cmd{ } } - var rules []hcloud.FirewallRule + var rules = make([]hcloud.FirewallRule, 0) for _, existingRule := range firewall.Rules { if !reflect.DeepEqual(existingRule, rule) { rules = append(rules, existingRule) diff --git a/internal/cmd/firewall/delete_rule_test.go b/internal/cmd/firewall/delete_rule_test.go index b693a79f..297456fd 100644 --- a/internal/cmd/firewall/delete_rule_test.go +++ b/internal/cmd/firewall/delete_rule_test.go @@ -36,7 +36,7 @@ func TestDeleteRule(t *testing.T) { Get(gomock.Any(), "test"). Return(fw, nil, nil) fx.Client.FirewallClient.EXPECT(). - SetRules(gomock.Any(), fw, hcloud.FirewallSetRulesOpts{Rules: nil}). + SetRules(gomock.Any(), fw, hcloud.FirewallSetRulesOpts{Rules: []hcloud.FirewallRule{}}). Return([]*hcloud.Action{{ID: 123}, {ID: 321}}, nil, nil) fx.ActionWaiter.EXPECT(). WaitForActions(gomock.Any(), gomock.Any(), []*hcloud.Action{{ID: 123}, {ID: 321}}).