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:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user