From f62a8e4cbac81d867108eeb44c8c15751b879f31 Mon Sep 17 00:00:00 2001 From: denisonbarbosa Date: Thu, 28 Nov 2024 07:18:47 -0400 Subject: [PATCH] Addressing issues pointed by linter --- .../integration_tests/adsysctl_policy_test.go | 4 +-- internal/ad/admxgen/dconf/dconf.go | 26 +++++++++---------- internal/cmdhandler/suggest.go | 12 ++++----- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cmd/adsysd/integration_tests/adsysctl_policy_test.go b/cmd/adsysd/integration_tests/adsysctl_policy_test.go index 908f6c10d..96162779f 100644 --- a/cmd/adsysd/integration_tests/adsysctl_policy_test.go +++ b/cmd/adsysd/integration_tests/adsysctl_policy_test.go @@ -1417,7 +1417,7 @@ func TestPolicyCompletion(t *testing.T) { } } -func modifyAndAddUsers(t *testing.T, new string, users ...string) (passwd string) { +func modifyAndAddUsers(t *testing.T, newUsername string, users ...string) (passwd string) { t.Helper() dest := filepath.Join(t.TempDir(), "passwd") @@ -1439,7 +1439,7 @@ func modifyAndAddUsers(t *testing.T, new string, users ...string) (passwd string for scanner.Scan() { l := scanner.Text() if strings.HasPrefix(l, fmt.Sprintf("%s:", u.Username)) { - l = fmt.Sprintf("%s%s", new, strings.TrimPrefix(l, u.Username)) + l = fmt.Sprintf("%s%s", newUsername, strings.TrimPrefix(l, u.Username)) } _, err = d.Write([]byte(l + "\n")) require.NoError(t, err, "Setup: can’t write to passwd temp file") diff --git a/internal/ad/admxgen/dconf/dconf.go b/internal/ad/admxgen/dconf/dconf.go index e695c4ede..efc059b11 100644 --- a/internal/ad/admxgen/dconf/dconf.go +++ b/internal/ad/admxgen/dconf/dconf.go @@ -156,19 +156,19 @@ func inflateToExpandedPolicies(policies []Policy, release, currentSessions strin } if m.widgetType == common.WidgetTypeLongDecimal { - min := ep.RangeValues.Min - if min == "" { - min = "0" + minValue := ep.RangeValues.Min + if minValue == "" { + minValue = "0" } - if min == "NaN" || min == "Inf" { - return nil, errors.New(gotext.Get("min value for long decimal is not a valid float: %s", min)) + if minValue == "NaN" || minValue == "Inf" { + return nil, errors.New(gotext.Get("min value for long decimal is not a valid float: %s", minValue)) } - s, err := strconv.ParseFloat(min, 64) + s, err := strconv.ParseFloat(minValue, 64) if err != nil { return nil, errors.New(gotext.Get("min value for long decimal is not a valid float: %v", err)) } - min = fmt.Sprintf("%f", math.Max(0, s)) - ep.RangeValues.Min = min + minValue = fmt.Sprintf("%f", math.Max(0, s)) + ep.RangeValues.Min = minValue } if m.widgetType == common.WidgetTypeLongDecimal || m.widgetType == common.WidgetTypeDecimal { ep.RangeValues.Min = strings.Split(ep.RangeValues.Min, ".")[0] @@ -300,16 +300,16 @@ func loadSchemasFromDisk(path string) (entries map[string]schemaEntry, defaultsF Min *float32 "xml:\"min,attr\"" Max *float32 "xml:\"max,attr\"" }{} { - var min, max string + var minValue, maxValue string if k.Range.Min != nil { - min = fmt.Sprintf("%f", *k.Range.Min) + minValue = fmt.Sprintf("%f", *k.Range.Min) } if k.Range.Max != nil { - max = fmt.Sprintf("%f", *k.Range.Max) + maxValue = fmt.Sprintf("%f", *k.Range.Max) } e.RangeValues = common.DecimalRange{ - Min: min, - Max: max, + Min: minValue, + Max: maxValue, } } diff --git a/internal/cmdhandler/suggest.go b/internal/cmdhandler/suggest.go index 2f2474dca..1a22d69df 100644 --- a/internal/cmdhandler/suggest.go +++ b/internal/cmdhandler/suggest.go @@ -95,14 +95,14 @@ func ld(s, t string, ignoreCase bool) int { if s[i-1] == t[j-1] { d[i][j] = d[i-1][j-1] } else { - min := d[i-1][j] - if d[i][j-1] < min { - min = d[i][j-1] + minValue := d[i-1][j] + if d[i][j-1] < minValue { + minValue = d[i][j-1] } - if d[i-1][j-1] < min { - min = d[i-1][j-1] + if d[i-1][j-1] < minValue { + minValue = d[i-1][j-1] } - d[i][j] = min + 1 + d[i][j] = minValue + 1 } } }