Utilities for calling functions only once. Safe for concurrent use. Supports generics.
go get github.com/livebud/once
count := 0
fn := once.Func(func() (int, error) {
count++
return count, nil
})
res, err := fn()
// 1
res, err = fn()
// 1
- Matt Mueller (@mattmueller)
MIT