Canonical guidance

Use when

Avoid

Preferred pattern

for i := range users {
	users[i].Active = true
}

Anti-pattern

Explanation: This anti-pattern is tempting because the loop variable looks like the element, but for most ranges it is just a copy of that value.

Why

Related pages

Sources