Canonical guidance

Use when

Avoid

Preferred pattern

var bufPool = sync.Pool{
	New: func() any { return new(bytes.Buffer) },
}

Anti-pattern

Explanation: This anti-pattern is tempting because the API says “pool”, but the runtime may drop entries whenever it likes.

Why

Related pages

Sources