Skip to content

Commit fa13b07

Browse files
committed
integration/internal/swarm: rename max/min as it collides with go1.21 builtin
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 79495c5 commit fa13b07

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

integration/internal/swarm/states.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,8 @@ func JobComplete(client client.CommonAPIClient, service swarmtypes.Service) func
9595
jobIteration = service.JobStatus.JobIteration
9696
}
9797

98-
maxRaw := service.Spec.Mode.ReplicatedJob.MaxConcurrent
99-
totalRaw := service.Spec.Mode.ReplicatedJob.TotalCompletions
100-
101-
max := int(*maxRaw)
102-
total := int(*totalRaw)
103-
98+
maxConcurrent := int(*service.Spec.Mode.ReplicatedJob.MaxConcurrent)
99+
totalCompletions := int(*service.Spec.Mode.ReplicatedJob.TotalCompletions)
104100
previousResult := ""
105101

106102
return func(log poll.LogT) poll.Result {
@@ -133,16 +129,16 @@ func JobComplete(client client.CommonAPIClient, service swarmtypes.Service) func
133129
}
134130

135131
switch {
136-
case running > max:
132+
case running > maxConcurrent:
137133
return poll.Error(fmt.Errorf(
138-
"number of running tasks (%v) exceeds max (%v)", running, max,
134+
"number of running tasks (%v) exceeds max (%v)", running, maxConcurrent,
139135
))
140-
case (completed + running) > total:
136+
case (completed + running) > totalCompletions:
141137
return poll.Error(fmt.Errorf(
142138
"number of tasks exceeds total (%v), %v running and %v completed",
143-
total, running, completed,
139+
totalCompletions, running, completed,
144140
))
145-
case completed == total && running == 0:
141+
case completed == totalCompletions && running == 0:
146142
return poll.Success()
147143
default:
148144
newRes := fmt.Sprintf(
@@ -156,7 +152,7 @@ func JobComplete(client client.CommonAPIClient, service swarmtypes.Service) func
156152

157153
return poll.Continue(
158154
"Job not yet finished, %v completed and %v running out of %v total",
159-
completed, running, total,
155+
completed, running, totalCompletions,
160156
)
161157
}
162158
}

0 commit comments

Comments
 (0)