github.com/docker/docker@v299999999.0.0-20200612211812-aaf470eca7b5+incompatible/pkg/platform/architecture_unix.go (about)

     1  // +build !windows
     2  
     3  // Package platform provides helper function to get the runtime architecture
     4  // for different platforms.
     5  package platform // import "github.com/docker/docker/pkg/platform"
     6  
     7  import (
     8  	"bytes"
     9  
    10  	"golang.org/x/sys/unix"
    11  )
    12  
    13  // runtimeArchitecture gets the name of the current architecture (x86, x86_64, i86pc, sun4v, ...)
    14  func runtimeArchitecture() (string, error) {
    15  	utsname := &unix.Utsname{}
    16  	if err := unix.Uname(utsname); err != nil {
    17  		return "", err
    18  	}
    19  	return string(utsname.Machine[:bytes.IndexByte(utsname.Machine[:], 0)]), nil
    20  }