architecture_unix.go 544 B

12345678910111213141516171819
  1. //go:build !windows
  2. // +build !windows
  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. import (
  7. "golang.org/x/sys/unix"
  8. )
  9. // runtimeArchitecture gets the name of the current architecture (x86, x86_64, i86pc, sun4v, ...)
  10. func runtimeArchitecture() (string, error) {
  11. utsname := &unix.Utsname{}
  12. if err := unix.Uname(utsname); err != nil {
  13. return "", err
  14. }
  15. return unix.ByteSliceToString(utsname.Machine[:]), nil
  16. }