Skip to content

fix: remove nil check#478

Merged
lbajolet-hashicorp merged 1 commit intomainfrom
fix/remove-nil-check
Oct 16, 2024
Merged

fix: remove nil check#478
lbajolet-hashicorp merged 1 commit intomainfrom
fix/remove-nil-check

Conversation

@tenthirtyam
Copy link
Copy Markdown
Collaborator

Summary

This pull request includes a small change to the builder/vsphere/clone/step_customize.go file that removes the nil check for w.RunOnceCommandList since len() for a nil slice is defined as zero. The change simplifies the conditional check

packer-plugin-vsphere on fix/remove-nil-check  via 🐹 v1.23.2 
➜ staticcheck builder/vsphere/clone/step_customize.go 
builder/vsphere/clone/step_customize.go:443:5: should omit nil check; len() for []string is defined as zero (S1009)
packer-plugin-vsphere on fix/remove-nil-check  via 🐹 v1.23.2 
➜ staticcheck builder/vsphere/clone/step_customize.go

packer-plugin-vsphere on fix/remove-nil-check  [!] via 🐹 v1.23.2 
➜       

Remove the nil check for `w.RunOnceCommandList` since `len()` for a `nil` slice is defined as zero.

Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
@tenthirtyam tenthirtyam added the technical-debt Technical Debt label Oct 16, 2024
@tenthirtyam tenthirtyam added this to the v1.4.1 milestone Oct 16, 2024
@tenthirtyam tenthirtyam self-assigned this Oct 16, 2024
@tenthirtyam tenthirtyam requested a review from a team as a code owner October 16, 2024 00:20
Copy link
Copy Markdown
Contributor

@lbajolet-hashicorp lbajolet-hashicorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, the nil check was superfluous as the length of a nil slice is always zero; LGTM!

@lbajolet-hashicorp lbajolet-hashicorp merged commit 4eb3fe1 into main Oct 16, 2024
@lbajolet-hashicorp lbajolet-hashicorp deleted the fix/remove-nil-check branch October 16, 2024 19:52
@github-actions
Copy link
Copy Markdown

I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

technical-debt Technical Debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants