1
0
mirror of https://github.com/docker/cli.git synced 2026-11-01 23:35:23 +03:00

modernize: minmax

go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
    modernize -minmax -fix ./...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2026-02-11 13:08:46 +01:00
parent e8dc2fce32
commit 85ebca52fd
3 changed files with 3 additions and 12 deletions

View File

@@ -389,10 +389,7 @@ func generateLegend(out tui.Output, width uint) string {
}
legend += legendSb371.String()
r := int(width) - tui.Width(legend)
if r < 0 {
r = 0
}
r := max(int(width)-tui.Width(legend), 0)
legend = strings.Repeat(" ", r) + legend
return legend
}

View File

@@ -191,10 +191,7 @@ func generateServices(t *testing.T, opts clusterOpts) client.ServiceListResult {
t.Helper()
// Can't have more global tasks than nodes
globalTasks := opts.runningTasks
if globalTasks > opts.activeNodes {
globalTasks = opts.activeNodes
}
globalTasks := min(opts.runningTasks, opts.activeNodes)
return client.ServiceListResult{
Items: []swarm.Service{
*builders.Service(

View File

@@ -662,10 +662,7 @@ func (u *replicatedJobProgressUpdater) writeOverallProgress(active, completed in
})
// actualDesired is the lesser of MaxConcurrent, or the remaining tasks
actualDesired := u.total - completed
if actualDesired > u.concurrent {
actualDesired = u.concurrent
}
actualDesired := min(u.total-completed, u.concurrent)
_ = u.progressOut.WriteProgress(progress.Progress{
ID: "active tasks",