2016-05-03 12:10:21 -04:00
|
|
|
// +build freebsd solaris darwin
|
2016-03-25 19:38:00 -04:00
|
|
|
|
2016-05-03 12:10:21 -04:00
|
|
|
// Package platform provides helper function to get the runtime architecture
|
|
|
|
// for different platforms.
|
2016-03-25 19:38:00 -04:00
|
|
|
package platform
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2016-05-03 12:10:21 -04:00
|
|
|
// runtimeArchitecture gets the name of the current architecture (x86, x86_64, i86pc, sun4v, ...)
|
2016-03-25 19:38:00 -04:00
|
|
|
func runtimeArchitecture() (string, error) {
|
|
|
|
cmd := exec.Command("/usr/bin/uname", "-m")
|
|
|
|
machine, err := cmd.Output()
|
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
|
|
|
return strings.TrimSpace(string(machine)), nil
|
|
|
|
}
|