Files
go-zero/core/syncx/once.go

10 lines
194 B
Go
Raw Normal View History

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)
}