From 81d927fd35765cc844c0aea12e5c7beb44d475e9 Mon Sep 17 00:00:00 2001 From: Tobias Bradtke Date: Sun, 4 Oct 2015 00:50:31 +0200 Subject: [PATCH 1/2] Change type Fixes compile error for me --- probe/host/system_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/probe/host/system_linux.go b/probe/host/system_linux.go index 4f7155aac..bc2e77b7b 100644 --- a/probe/host/system_linux.go +++ b/probe/host/system_linux.go @@ -12,7 +12,7 @@ import ( // Uname is swappable for mocking in tests. var Uname = syscall.Uname -func charsToString(ca [65]int8) string { +func charsToString(ca [65]uint8) string { s := make([]byte, len(ca)) var lens int for ; lens < len(ca); lens++ { From aab15cd5f5346ce5c361999ad176006710bce44b Mon Sep 17 00:00:00 2001 From: Tom Wilkie Date: Fri, 9 Oct 2015 11:03:22 +0000 Subject: [PATCH 2/2] Make scope build on arm. --- probe/host/system_linux.go | 12 ------------ probe/host/system_utils_linux.go | 15 +++++++++++++++ probe/host/system_utils_linux_arm.go | 13 +++++++++++++ 3 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 probe/host/system_utils_linux.go create mode 100644 probe/host/system_utils_linux_arm.go diff --git a/probe/host/system_linux.go b/probe/host/system_linux.go index bc2e77b7b..232769eab 100644 --- a/probe/host/system_linux.go +++ b/probe/host/system_linux.go @@ -12,18 +12,6 @@ import ( // Uname is swappable for mocking in tests. var Uname = syscall.Uname -func charsToString(ca [65]uint8) string { - s := make([]byte, len(ca)) - var lens int - for ; lens < len(ca); lens++ { - if ca[lens] == 0 { - break - } - s[lens] = uint8(ca[lens]) - } - return string(s[0:lens]) -} - // GetKernelVersion returns the kernel version as reported by uname. var GetKernelVersion = func() (string, error) { var utsname syscall.Utsname diff --git a/probe/host/system_utils_linux.go b/probe/host/system_utils_linux.go new file mode 100644 index 000000000..fc2ff876f --- /dev/null +++ b/probe/host/system_utils_linux.go @@ -0,0 +1,15 @@ +// +build !arm + +package host + +func charsToString(ca [65]int8) string { + s := make([]byte, len(ca)) + var lens int + for ; lens < len(ca); lens++ { + if ca[lens] == 0 { + break + } + s[lens] = uint8(ca[lens]) + } + return string(s[0:lens]) +} diff --git a/probe/host/system_utils_linux_arm.go b/probe/host/system_utils_linux_arm.go new file mode 100644 index 000000000..ee9eca9ef --- /dev/null +++ b/probe/host/system_utils_linux_arm.go @@ -0,0 +1,13 @@ +package host + +func charsToString(ca [65]uint8) string { + s := make([]byte, len(ca)) + var lens int + for ; lens < len(ca); lens++ { + if ca[lens] == 0 { + break + } + s[lens] = uint8(ca[lens]) + } + return string(s[0:lens]) +}