diff --git a/pkg/sloop/common/utilities.go b/pkg/sloop/common/utilities.go index 5546abbc..166152d7 100644 --- a/pkg/sloop/common/utilities.go +++ b/pkg/sloop/common/utilities.go @@ -58,6 +58,6 @@ func Truncate(text string, width int, delimiter ...string) (string, error) { return text, nil } r := []rune(text) - truncated := r[:(Max(width, d_len)-d_len)] + truncated := r[:(Max(width, d_len) - d_len)] return string(truncated) + d, nil } diff --git a/pkg/sloop/ingress/kubewatcher.go b/pkg/sloop/ingress/kubewatcher.go index 0191f446..f9c8dfa9 100644 --- a/pkg/sloop/ingress/kubewatcher.go +++ b/pkg/sloop/ingress/kubewatcher.go @@ -8,16 +8,17 @@ package ingress import ( + "bytes" "context" "encoding/json" "fmt" + "reflect" + "strings" "sync" "sync/atomic" "time" - "bytes" - "strings" - "reflect" + "github.com/diegoholiveira/jsonlogic/v3" "github.com/golang/glog" "github.com/golang/protobuf/ptypes" "github.com/pkg/errors" @@ -35,7 +36,6 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/tools/cache" - "github.com/diegoholiveira/jsonlogic/v3" ) /* @@ -373,18 +373,18 @@ func (i *kubeWatcherImpl) refreshCrdInformers(masterURL string, kubeContext stri } } -func (i *kubeWatcherImpl) getExclusionRules(kind string) ([]any) { +func (i *kubeWatcherImpl) getExclusionRules(kind string) []any { kindRules, _ := i.exclusionRules[kind] globalRules, _ := i.exclusionRules["_all"] combinedRules := append( kindRules, - globalRules... + globalRules..., ) glog.V(common.GlogVerbose).Infof("Fetched rules: %s", combinedRules) return combinedRules } -func (i *kubeWatcherImpl) eventExcluded(kind string, resourceJson string) (bool) { +func (i *kubeWatcherImpl) eventExcluded(kind string, resourceJson string) bool { filters := i.getExclusionRules(kind) for _, logic := range filters { logicJson, err := json.Marshal(logic)