mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
14 lines
167 B
Go
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()
|
|
}
|
|
}
|