Skip to content

Commit d1a174e

Browse files
authored
Merge pull request #1396 from atc0005/i1395-fix-copyloopvar-linting-errors
Fix `copyloopvar` linting errors
2 parents 63ab32d + 1c83f18 commit d1a174e

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

cmd/check_vmware_hs2ds2vms/main.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,10 @@ func main() {
298298
// Reassign the iteration variable inside the loop to prevent implicit
299299
// memory aliasing.
300300
// https://stackoverflow.com/questions/62446118/implicit-memory-aliasing-in-for-loop
301-
hostID, pairing := hostID, pairing
301+
//
302+
// NOTE: Not needed as of Go 1.22.
303+
//
304+
// hostID, pairing := hostID, pairing
302305

303306
dsNamesForHost := func(pairings vsphere.HostDatastoresPairing) string {
304307
names := make([]string, len(pairings.Datastores))

internal/vsphere/snapshots.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -875,10 +875,12 @@ func ListVMSnapshots(vm mo.VirtualMachine, w io.Writer) {
875875
}
876876

877877
for _, snapTree := range snapTrees {
878-
879878
// G601: Implicit memory aliasing in for loop
880879
// https://stackoverflow.com/questions/62446118/implicit-memory-aliasing-in-for-loop
881-
snapTree := snapTree
880+
//
881+
// NOTE: Not needed as of Go 1.22.
882+
//
883+
// snapTree := snapTree
882884

883885
daysAge := now.Sub(snapTree.CreateTime).Hours() / 24
884886

@@ -986,10 +988,12 @@ func NewSnapshotSummarySet(
986988
}
987989

988990
for _, snapTree := range snapTrees {
989-
990991
// G601: Implicit memory aliasing in for loop
991992
// https://stackoverflow.com/questions/62446118/implicit-memory-aliasing-in-for-loop
992-
snapTree := snapTree
993+
//
994+
// NOTE: Not needed as of Go 1.22.
995+
//
996+
// snapTree := snapTree
993997

994998
logger.Printf(
995999
"Processing snapshot: [ID: %s, Name: %s, HasParent: %t]\n",

0 commit comments

Comments
 (0)