Merge pull request #18090 from vdemeester/17478-follow-up-cleanup-pkg-platform
Follow-up of 17478, unexport runtimeArchitecture method
This commit is contained in:
commit
d178946c78
4 changed files with 7 additions and 7 deletions
|
@ -4,8 +4,8 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetRuntimeArchitecture get the name of the current architecture (x86, x86_64, …)
|
// runtimeArchitecture get the name of the current architecture (x86, x86_64, …)
|
||||||
func GetRuntimeArchitecture() (string, error) {
|
func runtimeArchitecture() (string, error) {
|
||||||
cmd := exec.Command("uname", "-m")
|
cmd := exec.Command("uname", "-m")
|
||||||
machine, err := cmd.Output()
|
machine, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetRuntimeArchitecture get the name of the current architecture (x86, x86_64, …)
|
// runtimeArchitecture get the name of the current architecture (x86, x86_64, …)
|
||||||
func GetRuntimeArchitecture() (string, error) {
|
func runtimeArchitecture() (string, error) {
|
||||||
utsname := &syscall.Utsname{}
|
utsname := &syscall.Utsname{}
|
||||||
if err := syscall.Uname(utsname); err != nil {
|
if err := syscall.Uname(utsname); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|
|
@ -36,8 +36,8 @@ const (
|
||||||
|
|
||||||
var sysinfo systeminfo
|
var sysinfo systeminfo
|
||||||
|
|
||||||
// GetRuntimeArchitecture get the name of the current architecture (x86, x86_64, …)
|
// runtimeArchitecture get the name of the current architecture (x86, x86_64, …)
|
||||||
func GetRuntimeArchitecture() (string, error) {
|
func runtimeArchitecture() (string, error) {
|
||||||
syscall.Syscall(procGetSystemInfo.Addr(), 1, uintptr(unsafe.Pointer(&sysinfo)), 0, 0)
|
syscall.Syscall(procGetSystemInfo.Addr(), 1, uintptr(unsafe.Pointer(&sysinfo)), 0, 0)
|
||||||
switch sysinfo.wProcessorArchitecture {
|
switch sysinfo.wProcessorArchitecture {
|
||||||
case ProcessorArchitecture64, ProcessorArchitectureIA64:
|
case ProcessorArchitecture64, ProcessorArchitectureIA64:
|
||||||
|
|
|
@ -15,7 +15,7 @@ var (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
var err error
|
var err error
|
||||||
Architecture, err = GetRuntimeArchitecture()
|
Architecture, err = runtimeArchitecture()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("Could no read system architecture info: %v", err)
|
logrus.Errorf("Could no read system architecture info: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue