This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix (Flux)HelmRelease cluster lookups
The value obtained by `_, value := range slice` is overwritten on every iteration. Thus, saving a pointer to `value` is dangerous since its content will be overwritten in the next iteration. From https://golang.org/ref/spec#For_range : > For each entry it assigns iteration values to corresponding > iteration variables if present and then executes the block. But the iteration variables are the same on each iteration. More explicitly, from [the gccgo source code](https://github.com/golang/gofrontend/blob/e387439bfd24d5e142874b8e68e7039f74c744d7/go/statements.cc#L5593-L5604): ``` // The loop we generate: // len_temp := len(range) // range_temp := range // for index_temp = 0; index_temp < len_temp; index_temp++ { // value_temp = range_temp[index_temp] // index = index_temp // value = value_temp // original body // } ```
- Loading branch information