Canonical guidance

Use when

Avoid

Preferred pattern

if u, ok := v.(User); ok {
	return u.ID
}
return ""

Anti-pattern

Explanation: This anti-pattern is tempting because the syntax is short, but it turns a common branch into a runtime panic.

Why

Related pages

Sources