mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 12:32:26 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			13 lines
		
	
	
	
		
			167 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			13 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()
 | |
| 	}
 | |
| }
 |