architecture_linux.go 420 B

12345678910111213141516
  1. // Package platform provides helper function to get the runtime architecture
  2. // for different platforms.
  3. package platform
  4. import (
  5. "syscall"
  6. )
  7. // runtimeArchitecture gets the name of the current architecture (x86, x86_64, …)
  8. func runtimeArchitecture() (string, error) {
  9. utsname := &syscall.Utsname{}
  10. if err := syscall.Uname(utsname); err != nil {
  11. return "", err
  12. }
  13. return charsToString(utsname.Machine), nil
  14. }