Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

govc: Fix memory aliasing in for loop (gosec G601) #3215

Merged

Conversation

atc0005
Copy link
Contributor

@atc0005 atc0005 commented Aug 23, 2023

Description

Explicitly reassign the iteration variable used for listing virtual machine snapshots to fix the gosec G601 "Implicit memory aliasing in for loop" error.

Type of change

Please mark options that are relevant:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)
  • This change requires a documentation update
  • Build related change

How Has This Been Tested?

  • go build ./...
  • go test -v ./govc

Checklist:

  • My code follows the CONTRIBUTION guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

Fix gosec G601 "Implicit memory aliasing in for loop" error
by reassigning the iteration variable inside the loop.

refs vmwareGH-2243
refs vmwareGH-2269
Copy link
Member

@dougm dougm left a comment

Choose a reason for hiding this comment

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

Thanks @atc0005

@dougm dougm merged commit 0695ee6 into vmware:main Aug 24, 2023
10 checks passed
@atc0005 atc0005 deleted the i2243-fix-gosec-601-memory-aliasing-error branch August 24, 2023 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants