github.com/hms58/moby@v1.13.1/pkg/platform/architecture_unix.go (about)

     1  // +build freebsd solaris darwin
     2  
     3  // Package platform provides helper function to get the runtime architecture
     4  // for different platforms.
     5  package platform
     6  
     7  import (
     8  	"os/exec"
     9  	"strings"
    10  )
    11  
    12  // runtimeArchitecture gets the name of the current architecture (x86, x86_64, i86pc, sun4v, ...)
    13  func runtimeArchitecture() (string, error) {
    14  	cmd := exec.Command("/usr/bin/uname", "-m")
    15  	machine, err := cmd.Output()
    16  	if err != nil {
    17  		return "", err
    18  	}
    19  	return strings.TrimSpace(string(machine)), nil
    20  }