Skip to content

Glossary: Software Design Patterns in Go

sync.Once

Also written: once.Do

A Go standard-library type whose `Do` method runs a function the first time it's called and never again, even with several goroutines. It builds a singleton on first use.

Where the book teaches it

Related terms

SingletonGoroutine