Skip to content
masterclass Buddy

Go · Class

sync.Once

sync.Once runs one function exactly once for a given Once value. Other callers wait for that function to finish, and later calls do nothing.

Last updated

Syntax

func (o *Once) Do(f func())

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • sync.Mutex
  • sync/atomic.Bool
  • Go memory model

Source: once.go - The Go Programming Language. Checked 2026-11-03.