[PR #1955] [MERGED] refactor: remove unnecessary nil check in RunContext #2208

Closed
opened 2026-03-01 21:54:28 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/1955
Author: @Juneezee
Created: 8/9/2023
Status: Merged
Merged: 8/9/2023
Merged by: @mergify[bot]

Base: masterHead: master


📝 Commits (1)

  • 5a2e6f6 refactor: remove unnecessary nil check in RunContext

📊 Changes

1 file changed (+9 additions, -11 deletions)

View changed files

📝 pkg/runner/run_context.go (+9 -11)

📄 Description

From the Go docs:

"For a nil slice, the number of iterations is 0" https://go.dev/ref/spec#For_range

Therefore, an additional nil check for job.RunsOn() before the loop is unnecessary because job.RunsOn() returns a []string. Example: https://go.dev/play/p/cmcRrMJ6Mb4


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/1955 **Author:** [@Juneezee](https://github.com/Juneezee) **Created:** 8/9/2023 **Status:** ✅ Merged **Merged:** 8/9/2023 **Merged by:** [@mergify[bot]](https://github.com/apps/mergify) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`5a2e6f6`](https://github.com/nektos/act/commit/5a2e6f6988e4b97a0466b26c70c7272f9daf8335) refactor: remove unnecessary nil check in RunContext ### 📊 Changes **1 file changed** (+9 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `pkg/runner/run_context.go` (+9 -11) </details> ### 📄 Description From the Go docs: > "For a nil slice, the number of iterations is 0" https://go.dev/ref/spec#For_range Therefore, an additional nil check for `job.RunsOn()` before the loop is unnecessary because `job.RunsOn()` returns a `[]string`. Example: https://go.dev/play/p/cmcRrMJ6Mb4 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:54:28 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#2208
No description provided.