github.com/ttys3/engine@v17.12.1-ce-rc2+incompatible/pkg/platform/architecture_linux.go (about)

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