Closed shirou closed 5 months ago
Tested on aarch64
. It works somehow, but I'm not sure if the output is correct.
root@s1:~/go-test# cat test.go
package main
import (
"fmt"
"github.com/shirou/gopsutil/v3/host"
)
func main() {
fmt.Println(host.Users())
}
root@s1:~/go-test# go run test.go
[{"user":"/0jrypacek","terminal":"","host":"","started":112033681178624} {"user":"/1jrypacek","terminal":"","host":"","started":112033693171712}] <nil>
root@s1:~/go-test# who
jrypacek pts/0 2024-03-03 21:38 (1.2.3.4)
jrypacek pts/1 2024-03-03 21:41 (1.2.3.4)
@JosefRypacek Thank you for your quick confirmation. I found a padding was missing. I added it on cbefbb0. Sorry to bother you, but could you try again?
Works better now. Thanks!
root@s1:~/go-test# go run test.go
[{"user":"jrypacek","terminal":"pts/0","host":"1.2.3.4","started":1709564619} {"user":"jrypacek","terminal":"pts/1","host":"1.2.3.4","started":1709564625}] <nil>
fix: #1129
Update host_linux_arm64.go with below environment
Note: type file has been changed by hand
uint -> int
The cgo command output
[]uint
in arm64. But it is[]int
, at least on amd64. This difference caused build to fail on arm64.There is a technique to use generics, but I changed it by editing the arm64 definition from uint to int by hand, in order to keep backward compatibility.
added padding after type
padding is required for parse.