gimlet-io / capacitor

A general purpose UI for FluxCD.
Apache License 2.0
634 stars 21 forks source link

Bugfix: Copying address of a loop variable #30

Closed dzsak closed 10 months ago

dzsak commented 10 months ago

The iteration variables of for range loop are re-used each iteration. It is the same variable and it is re-assigned each iteration, therefore the multiple elements of the deploymentsInNamespace slice referring to the same Deployment object. The one-liner d := deployment fix the problem because the redeclaration creates a new variable each iteration and has the value of iteration variable.