Closed devinstasafe closed 3 years ago
Would the KernelArch field from what's returned by host.Info()
fit the bill for you? https://godocs.io/github.com/shirou/gopsutil/v3/host#InfoStat host.KernelArch()
returns the same thing of course if you're only interested in that https://godocs.io/github.com/shirou/gopsutil/v3/host#KernelArch
Otherwise there's also cpu.Info()
to gather physical processor information https://godocs.io/github.com/shirou/gopsutil/v3/cpu#InfoStat, though information there is less normalized than host.KernelArch(), from architecture to architecture and OS to OS (it's what is returned by the OS, almost as-is).
As we know
runtime.GOARCH
provides the architecture the executable was compiled for and not the capabilities of the underlying OS and/or CPU.It'd be helpful if a feature is added if I know the OS is 64 bit (and I'm running 32 bit binary) and if the processor supports 64 bit