blob: 882ccb760751861b9abf9a8bba7f5bb764d4b894 [file] [log] [blame]
package platform
import "syscall"
// GetPlatform returns the description of the Platform this process is running on.
// A default value for Platform is provided even if an error is
// returned; nil is never returned for the first return result.
func GetPlatform() (*Platform, error) {
var uts syscall.Utsname
if err := syscall.Uname(&uts); err != nil {
return &Platform{}, err
}
d := &Platform{
Vendor: "google",
Model: "generic",
System: utsStr(uts.Sysname[:]),
Version: utsStr(uts.Version[:]),
Release: utsStr(uts.Release[:]),
Machine: utsStr(uts.Machine[:]),
Node: utsStr(uts.Nodename[:]),
}
return d, nil
}