Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: remove nil check #478

Merged
merged 1 commit into from
Oct 16, 2024
Merged

fix: remove nil check #478

merged 1 commit into from
Oct 16, 2024

Conversation

tenthirtyam
Copy link
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 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
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
14 checks passed
@lbajolet-hashicorp lbajolet-hashicorp deleted the fix/remove-nil-check branch October 16, 2024 19:52
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants