2016-05-03 16:10:21 +00:00
|
|
|
// +build freebsd solaris darwin
|
2016-03-25 23:38:00 +00:00
|
|
|
|
2016-05-03 16:10:21 +00:00
|
|
|
// Package platform provides helper function to get the runtime architecture
|
|
|
|
// for different platforms.
|
2016-03-25 23:38:00 +00:00
|
|
|
package platform
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2016-05-03 16:10:21 +00:00
|
|
|
// runtimeArchitecture gets the name of the current architecture (x86, x86_64, i86pc, sun4v, ...)
|
2016-03-25 23:38:00 +00: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
|
|
|
|
}
|