Skip to content

Commit

Permalink
Addressing issues pointed by linter
Browse files Browse the repository at this point in the history
  • Loading branch information
denisonbarbosa committed Nov 28, 2024
1 parent cdbe15a commit f62a8e4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions cmd/adsysd/integration_tests/adsysctl_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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")
Expand Down
26 changes: 13 additions & 13 deletions internal/ad/admxgen/dconf/dconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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,
}
}

Expand Down
12 changes: 6 additions & 6 deletions internal/cmdhandler/suggest.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down

0 comments on commit f62a8e4

Please sign in to comment.