Canonical guidance

Use when

Avoid

Preferred pattern

var buf bytes.Buffer
buf.WriteString("ok")

Anti-pattern

type Client struct {
	conn *Conn
}

Explanation: This anti-pattern is tempting when constructors are familiar from other languages, but unnecessary ceremony fights Go’s zero-value conventions.

Why

Sources