MCPcopy
hub / github.com/tailscale/tailscale / MustDefer

Method MustDefer

types/lazy/deferred.go:59–63  ·  view source on GitHub ↗

MustDefer is like [DeferredFuncs.Defer], but panics if [DeferredInit.Do] has already been called.

(f func() error)

Source from the content-addressed store, hash-verified

57// MustDefer is like [DeferredFuncs.Defer], but panics
58// if [DeferredInit.Do] has already been called.
59func (d *DeferredFuncs) MustDefer(f func() error) {
60 if !d.Defer(f) {
61 panic("deferred init already completed")
62 }
63}
64
65// Do calls previously deferred init functions if it is being called
66// for the first time on this instance of [DeferredInit].

Callers 4

ExampleDeferredInitFunction · 0.80
TestDeferredErrFunction · 0.80
initFunction · 0.80
initFunction · 0.80

Calls 1

DeferMethod · 0.95

Tested by 2

ExampleDeferredInitFunction · 0.64
TestDeferredErrFunction · 0.64