github.com/undoio/delve@v1.9.0/pkg/proc/macutil/rosetta_darwin.go (about)

     1  package macutil
     2  
     3  import (
     4  	"errors"
     5  	"syscall"
     6  )
     7  
     8  // CheckRosetta returns an error if the calling process is being translated
     9  // by Apple Rosetta.
    10  func CheckRosetta() error {
    11  	pt, err := syscall.Sysctl("sysctl.proc_translated")
    12  	if err != nil {
    13  		return nil
    14  	}
    15  	if len(pt) > 0 && pt[0] == 1 {
    16  		return errors.New("can not run under Rosetta, check that the installed build of Go is right for your CPU architecture")
    17  	}
    18  	return nil
    19  }