Skip to content

Latest commit

 

History

History
33 lines (23 loc) · 512 Bytes

Readme.md

File metadata and controls

33 lines (23 loc) · 512 Bytes

Once

Go Reference

Utilities for calling functions only once. Safe for concurrent use. Supports generics.

Install

go get github.com/livebud/once

Usage

count := 0
fn := once.Func(func() (int, error) {
  count++
  return count, nil
})
res, err := fn()
// 1
res, err = fn()
// 1

Contributors

License

MIT