Format with gofumpt

This commit is contained in:
Holger Obermaier
2026-02-16 14:16:03 +01:00
parent 9bb21b807a
commit 539581f952
28 changed files with 294 additions and 310 deletions

View File

@@ -72,10 +72,12 @@ var metricCacheLanguage = gval.NewLanguage(
gval.Function("getCpuList", getCpuListOfNode),
gval.Function("getCpuListOfType", getCpuListOfType),
)
var language gval.Language = gval.NewLanguage(
gval.Full(),
metricCacheLanguage,
)
var evaluables = struct {
mapping map[string]gval.Evaluable
mutex sync.Mutex
@@ -359,10 +361,9 @@ func EvalBoolCondition(condition string, params map[string]any) (bool, error) {
evaluable, ok := evaluables.mapping[condition]
evaluables.mutex.Unlock()
if !ok {
newcond :=
newcond := strings.ReplaceAll(
strings.ReplaceAll(
strings.ReplaceAll(
condition, "'", "\""), "%", "\\")
condition, "'", "\""), "%", "\\")
var err error
evaluable, err = language.NewEvaluable(newcond)
if err != nil {
@@ -381,10 +382,9 @@ func EvalFloat64Condition(condition string, params map[string]float64) (float64,
evaluable, ok := evaluables.mapping[condition]
evaluables.mutex.Unlock()
if !ok {
newcond :=
newcond := strings.ReplaceAll(
strings.ReplaceAll(
strings.ReplaceAll(
condition, "'", "\""), "%", "\\")
condition, "'", "\""), "%", "\\")
var err error
evaluable, err = language.NewEvaluable(newcond)
if err != nil {

View File

@@ -35,7 +35,6 @@ func sumAnyType[T float64 | float32 | int | int32 | int64](values []T) (T, error
// Sum up values
func sumfunc(args any) (any, error) {
var err error
switch values := args.(type) {
case []float64:
@@ -168,7 +167,7 @@ func medianfunc(args any) (any, error) {
*/
func lenfunc(args any) (any, error) {
var err error = nil
var err error
length := 0
switch values := args.(type) {
case []float64: