Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Labarussias <issif+github@gadz.org>
  • Loading branch information
Issif committed Feb 15, 2024
1 parent c617be6 commit a623905
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions actionners/kubernetes/delete/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"github.com/Falco-Talon/falco-talon/utils"
)

const namespaces string = "namespaces"

func Action(_ *rules.Action, event *events.Event) (utils.LogLine, error) {
name := event.GetTargetName()
resource := event.GetTargetResource()
Expand All @@ -29,7 +31,7 @@ func Action(_ *rules.Action, event *events.Event) (utils.LogLine, error) {
var err error

switch resource {
case "namespaces":
case namespaces:
err = client.Clientset.CoreV1().Namespaces().Delete(context.Background(), name, metav1.DeleteOptions{})
case "configmaps":
err = client.Clientset.CoreV1().ConfigMaps(namespace).Delete(context.Background(), name, metav1.DeleteOptions{})
Expand Down Expand Up @@ -63,7 +65,7 @@ func Action(_ *rules.Action, event *events.Event) (utils.LogLine, error) {
}

var output string
if resource == "namespaces" {
if resource == namespaces {
output = fmt.Sprintf("the %v '%v' has been deleted", strings.TrimSuffix(resource, "s"), name)
} else {
output = fmt.Sprintf("the %v '%v' in the namespace '%v' has been deleted", strings.TrimSuffix(resource, "s"), name, namespace)
Expand Down
1 change: 0 additions & 1 deletion notifiers/elasticsearch/elasticsearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func Init(fields map[string]interface{}) error {
}

func Notify(log utils.LogLine) error {

client := http.DefaultClient()

current := time.Now()
Expand Down
7 changes: 4 additions & 3 deletions notifiers/k8sevents/k8sevents.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import (
)

const (
falcoTalon = "falco-talon"
falcoTalon string = "falco-talon"
defaultStr string = "default"
)

var plaintextTmpl = `Status: {{ .Status }}
Expand Down Expand Up @@ -65,10 +66,10 @@ func Notify(log utils.LogLine) error {
namespace := log.Objects["namespace"]
ns, err := client.GetNamespace(log.Objects["namespace"])
if err != nil {
namespace = "default"
namespace = defaultStr
}
if ns == nil {
namespace = "default"
namespace = defaultStr
}

k8sevent := &corev1.Event{
Expand Down

0 comments on commit a623905

Please sign in to comment.