Files
go-zero/core/syncx/once.go
2025-05-11 20:19:00 +08:00

10 lines
194 B
Go

package syncx
import "sync"
// Once returns a func that guarantees fn can only called once.
// Deprecated: use sync.OnceFunc instead.
func Once(fn func()) func() {
return sync.OnceFunc(fn)
}