gotosocial/vendor/codeberg.org/gruf/go-structr/util.go
2024-10-02 10:58:20 +00:00

14 lines
167 B
Go

package structr
// once only executes 'fn' once.
func once(fn func()) func() {
var once int32
return func() {
if once != 0 {
return
}
once = 1
fn()
}
}