EasyOnce is a wrapper for the sync.Once functionality which lets you define and register the associated `run once` function at declaration time. It may be copied at any time.
| 60 | // and register the associated `run once` function at declaration time. It may |
| 61 | // be copied at any time. |
| 62 | type EasyOnce struct { |
| 63 | Func func() |
| 64 | |
| 65 | once *sync.Once |
| 66 | } |
| 67 | |
| 68 | // Done runs the function which was defined in `Func` a maximum of once. Please |
| 69 | // note that this is not currently thread-safe. Wrap calls to this with a mutex. |
nothing calls this directly
no outgoing calls
no test coverage detected