From 050365e4d0735feb6b8ab1e8c5939b36beeb355d Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Thu, 27 Apr 2023 16:18:50 -0700 Subject: [PATCH] Inline a constant so it's individualized to each task run --- cli/internal/run/real_run.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cli/internal/run/real_run.go b/cli/internal/run/real_run.go index 9f869e1c7b632..65c530602197b 100644 --- a/cli/internal/run/real_run.go +++ b/cli/internal/run/real_run.go @@ -215,8 +215,9 @@ func (ec *execContext) logError(prefix string, err error) { func (ec *execContext) exec(ctx gocontext.Context, packageTask *nodes.PackageTask) (*runsummary.TaskExecutionSummary, error) { // Setup tracer. Every time tracer() is called the taskExecutionSummary's duration is updated // So make sure to call it before returning. - tracer, taskExecutionSummary := ec.runSummary.RunSummary.TrackTask(packageTask.TaskID) + successExitCode := 0 // We won't use this till later + tracer, taskExecutionSummary := ec.runSummary.RunSummary.TrackTask(packageTask.TaskID) progressLogger := ec.logger.Named("") progressLogger.Debug("start") @@ -236,7 +237,7 @@ func (ec *execContext) exec(ctx gocontext.Context, packageTask *nodes.PackageTas } // Set building status now that we know it's going to run. - tracer(runsummary.TargetBuilding, nil, &successCode) + tracer(runsummary.TargetBuilding, nil, &successExitCode) var prefix string var prettyPrefix string @@ -273,8 +274,8 @@ func (ec *execContext) exec(ctx gocontext.Context, packageTask *nodes.PackageTas prefixedUI.Error(fmt.Sprintf("error fetching from cache: %s", err)) } else if cacheStatus.Local || cacheStatus.Remote { // If there was a cache hit ec.taskHashTracker.SetExpandedOutputs(packageTask.TaskID, taskCache.ExpandedOutputs) - // We only cache successful executions, so we can assume this is a successCode exit. - tracer(runsummary.TargetCached, nil, &successCode) + // We only cache successful executions, so we can assume this is a successExitCode exit. + tracer(runsummary.TargetCached, nil, &successExitCode) return taskExecutionSummary, nil } @@ -411,9 +412,8 @@ func (ec *execContext) exec(ctx gocontext.Context, packageTask *nodes.PackageTas } // Clean up tracing - tracer(runsummary.TargetBuilt, nil, &successCode) + + tracer(runsummary.TargetBuilt, nil, &successExitCode) progressLogger.Debug("done", "status", "complete", "duration", taskExecutionSummary.Duration) return taskExecutionSummary, nil } - -var successCode = 0