Do calls previously deferred init functions if it is being called for the first time on this instance of [DeferredInit]. It stops and returns an error if any init function returns an error. It is safe for concurrent use, and the deferred init is guaranteed to have been completed, either successfull
()
| 70 | // to have been completed, either successfully or with an error, |
| 71 | // when Do() returns. |
| 72 | func (d *DeferredInit) Do() error { |
| 73 | err := d.err.Load() |
| 74 | if err == nil { |
| 75 | err = d.doSlow() |
| 76 | } |
| 77 | return *err |
| 78 | } |
| 79 | |
| 80 | func (d *DeferredInit) doSlow() (err *error) { |
| 81 | d.m.Lock() |