44 lines
865 B
Go
44 lines
865 B
Go
package sprigx
|
|
|
|
import (
|
|
`github.com/shirou/gopsutil/v4/host`
|
|
)
|
|
|
|
/*
|
|
psHostPlatInfo returns a "squashed" github.com/shirou/gopsutil/v4/host.PlatformInformation;
|
|
normally it returns a (string, string, string, error)
|
|
but you can only have a (any) or (any, error) return in Golang templates.
|
|
*/
|
|
func psHostPlatInfo() (platInfo [3]string, err error) {
|
|
|
|
var s1 string
|
|
var s2 string
|
|
var s3 string
|
|
|
|
if s1, s2, s3, err = host.PlatformInformation(); err != nil {
|
|
return
|
|
}
|
|
|
|
platInfo = [3]string{s1, s2, s3}
|
|
|
|
return
|
|
}
|
|
|
|
/*
|
|
psHostVirt returns a "squared" github.com/shirou/gopsutil/v4/host.Virtualization;
|
|
normally it returns a (string, string, error) but Go templates etc.
|
|
*/
|
|
func psHostVirt() (virtInfo [2]string, err error) {
|
|
|
|
var s1 string
|
|
var s2 string
|
|
|
|
if s1, s2, err = host.Virtualization(); err != nil {
|
|
return
|
|
}
|
|
|
|
virtInfo = [2]string{s1, s2}
|
|
|
|
return
|
|
}
|