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