mirror of
				https://github.com/lzh-1625/go_process_manager.git
				synced 2025-10-31 11:26:49 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			24 lines
		
	
	
		
			309 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			309 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package utils
 | |
| 
 | |
| import "strconv"
 | |
| 
 | |
| func Unwarp[T any](result T, err error) T {
 | |
| 	if err != nil {
 | |
| 		panic(err)
 | |
| 	}
 | |
| 	return result
 | |
| }
 | |
| 
 | |
| func UnwarpIgnore[T any](result T, _ any) T {
 | |
| 	return result
 | |
| }
 | |
| 
 | |
| func GetIntByString(s string) int {
 | |
| 	i, err := strconv.Atoi(s)
 | |
| 	if err != nil {
 | |
| 		return 0
 | |
| 	} else {
 | |
| 		return i
 | |
| 	}
 | |
| }
 | 
