Canonical guidance

Use when

Avoid

Preferred pattern

for _, r := range s {
	fmt.Println(r)
}

Anti-pattern

Explanation: This anti-pattern is tempting because byte indexing is simple, but it breaks once multibyte UTF-8 input appears.

Why

Related pages

Sources