mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-09 16:50:28 +00:00
refactor: remove unnecessary nil check in RunContext (#1955)
From the Go docs: "For a nil slice, the number of iterations is 0" [1] Therefore, an additional nil check for `job.RunsOn()` before the loop is unnecessary because `job.RunsOn()` returns a `[]string`. [1]: https://go.dev/ref/spec#For_range Signed-off-by: Eng Zer Jun <[email protected]>
This commit is contained in:
1 parent
a42f3cf1cd
commit
8a9e4f9f38
1 file changed
-2
@@ -789,7 +789,6 @@ func (rc *RunContext) withGithubEnv(ctx context.Context, github *model.GithubCon
|
|||||||
}
|
}
|
||||||
|
|
||||||
job := rc.Run.Job()
|
job := rc.Run.Job()
|
||||||
if job.RunsOn() != nil {
|
|
||||||
for _, runnerLabel := range job.RunsOn() {
|
for _, runnerLabel := range job.RunsOn() {
|
||||||
platformName := rc.ExprEval.Interpolate(ctx, runnerLabel)
|
platformName := rc.ExprEval.Interpolate(ctx, runnerLabel)
|
||||||
if platformName != "" {
|
if platformName != "" {
|
||||||
@@ -802,7 +801,6 @@ func (rc *RunContext) withGithubEnv(ctx context.Context, github *model.GithubCon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return env
|
return env
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user