mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 14:12:26 -05:00 
			
		
		
		
	* updates go-structr and go-mangler to no longer rely on modern-go/reflect2 (*phew* now we're go1.23 safe) * update go-structr version * bump go-structr to improve memory usage (v. slightly) in certain conditions
		
			
				
	
	
		
			21 lines
		
	
	
	
		
			374 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
	
		
			374 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package structr
 | |
| 
 | |
| import "unsafe"
 | |
| 
 | |
| // once only executes 'fn' once.
 | |
| func once(fn func()) func() {
 | |
| 	var once int32
 | |
| 	return func() {
 | |
| 		if once != 0 {
 | |
| 			return
 | |
| 		}
 | |
| 		once = 1
 | |
| 		fn()
 | |
| 	}
 | |
| }
 | |
| 
 | |
| // eface_data returns the data ptr from an empty interface.
 | |
| func eface_data(a any) unsafe.Pointer {
 | |
| 	type eface struct{ _, data unsafe.Pointer }
 | |
| 	return (*eface)(unsafe.Pointer(&a)).data
 | |
| }
 |