mirror of
				https://github.com/go-delve/delve.git
				synced 2025-10-31 18:57:18 +08:00 
			
		
		
		
	 b9fcb03ff4
			
		
	
	b9fcb03ff4
	
	
	
		
			
			Delve does not run under Rosetta. Detect this condition and point confused users towards the solution.
		
			
				
	
	
		
			20 lines
		
	
	
		
			432 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			432 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package macutil
 | |
| 
 | |
| import (
 | |
| 	"errors"
 | |
| 	"syscall"
 | |
| )
 | |
| 
 | |
| // CheckRosetta returns an error if the calling process is being translated
 | |
| // by Apple Rosetta.
 | |
| func CheckRosetta() error {
 | |
| 	pt, err := syscall.Sysctl("sysctl.proc_translated")
 | |
| 	if err != nil {
 | |
| 		return nil
 | |
| 	}
 | |
| 	if len(pt) > 0 && pt[0] == 1 {
 | |
| 		return errors.New("can not run under Rosetta, check that the installed build of Go is right for your CPU architecture")
 | |
| 	}
 | |
| 	return nil
 | |
| }
 |