MCPcopy
hub / github.com/dropbox/godropbox / NewSingleton

Function NewSingleton

singleton/singleton.go:29–31  ·  view source on GitHub ↗

Call to create a new singleton that is instantiated with the given init function. init is not called until the first invocation of Get(). If init errors, it will be called again on the next invocation of Get().

(init SingletonInitFunc)

Source from the content-addressed store, hash-verified

27// init is not called until the first invocation of Get(). If init errors, it will be called again
28// on the next invocation of Get().
29func NewSingleton(init SingletonInitFunc) Singleton {
30 return &singletonImpl{init: init}
31}
32
33type singletonImpl struct {
34 sync.Mutex

Callers 1

TestGetMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestGetMethod · 0.68