range-value-address
Default severity: warning
Taking the address of a range value points to the iteration copy, not the
corresponding slice or array element. Go 1.22 made variables declared with :=
iteration-local, so this is no longer the classic shared-pointer bug, but the
pointer still does not refer back to the source collection. Use an index when
that source identity is intended.
for _, value := range values { pointers = append(pointers, &value)}for index := range values { pointers = append(pointers, &values[index])}