Files
go_goutils/tplx/sprigx/funcs_tpl_psutils.go
brent saner 1bd6e1256c v1.16.3
ADDED:
* Much more functions to tplx/sprigx
2026-01-29 19:02:21 -05:00

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
}