瀏覽代碼

integration/internal/swarm: rename max/min as it collides with go1.21 builtin

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 1 年之前
父節點
當前提交
fa13b0715f
共有 1 個文件被更改,包括 8 次插入12 次删除
  1. 8 12
      integration/internal/swarm/states.go

+ 8 - 12
integration/internal/swarm/states.go

@@ -95,12 +95,8 @@ func JobComplete(client client.CommonAPIClient, service swarmtypes.Service) func
 		jobIteration = service.JobStatus.JobIteration
 	}
 
-	maxRaw := service.Spec.Mode.ReplicatedJob.MaxConcurrent
-	totalRaw := service.Spec.Mode.ReplicatedJob.TotalCompletions
-
-	max := int(*maxRaw)
-	total := int(*totalRaw)
-
+	maxConcurrent := int(*service.Spec.Mode.ReplicatedJob.MaxConcurrent)
+	totalCompletions := int(*service.Spec.Mode.ReplicatedJob.TotalCompletions)
 	previousResult := ""
 
 	return func(log poll.LogT) poll.Result {
@@ -133,16 +129,16 @@ func JobComplete(client client.CommonAPIClient, service swarmtypes.Service) func
 		}
 
 		switch {
-		case running > max:
+		case running > maxConcurrent:
 			return poll.Error(fmt.Errorf(
-				"number of running tasks (%v) exceeds max (%v)", running, max,
+				"number of running tasks (%v) exceeds max (%v)", running, maxConcurrent,
 			))
-		case (completed + running) > total:
+		case (completed + running) > totalCompletions:
 			return poll.Error(fmt.Errorf(
 				"number of tasks exceeds total (%v), %v running and %v completed",
-				total, running, completed,
+				totalCompletions, running, completed,
 			))
-		case completed == total && running == 0:
+		case completed == totalCompletions && running == 0:
 			return poll.Success()
 		default:
 			newRes := fmt.Sprintf(
@@ -156,7 +152,7 @@ func JobComplete(client client.CommonAPIClient, service swarmtypes.Service) func
 
 			return poll.Continue(
 				"Job not yet finished, %v completed and %v running out of %v total",
-				completed, running, total,
+				completed, running, totalCompletions,
 			)
 		}
 	}