// Get information about the operating system. func Get() (OpSys, error) { opsys := OpSys{} o, err := common.ExecCmdFields("lsb_release", []string{"-a"}, ":", []string{ "Distributor ID", "Release", }) if err != nil { return OpSys{}, err } opsys.Kernel = runtime.GOOS opsys.Product = o["Distributor ID"] opsys.ProductVersion = o["Release"] opsys.KernelVersion, err = common.ExecCmd("uname", []string{"-r"}) if err != nil { return OpSys{}, err } return opsys, nil }
// Get information about the operating system. func Get() (OpSys, error) { opsys := OpSys{} o, err := common.ExecCmdFields("/usr/bin/sw_vers", []string{}, ":", []string{ "ProductName", "ProductVersion", }) if err != nil { return OpSys{}, err } opsys.Kernel = runtime.GOOS opsys.Product = o["ProductName"] opsys.ProductVersion = o["ProductVersion"] opsys.KernelVersion, err = common.ExecCmd("uname", []string{"-r"}) if err != nil { return OpSys{}, err } return opsys, nil }
func (op *opSys) ForceUpdate() error { op.cache.LastUpdated = time.Now() op.cache.FromCache = false o, err := common.ExecCmdFields("lsb_release", []string{"-a"}, ":", []string{ "Distributor ID", "Release", }) if err != nil { return err } op.data.Kernel = runtime.GOOS op.data.Product = o["Distributor ID"] op.data.ProductVersion = o["Release"] op.data.KernelVersion, err = common.ExecCmd("uname", []string{"-r"}) if err != nil { return err } return nil }
func (op *opSys) ForceUpdate() error { op.cache.LastUpdated = time.Now() op.cache.FromCache = false o, err := common.ExecCmdFields("/usr/bin/sw_vers", []string{}, ":", []string{ "ProductName", "ProductVersion", }) if err != nil { return err } op.data.Kernel = runtime.GOOS op.data.Product = o["ProductName"] op.data.ProductVersion = o["ProductVersion"] op.data.KernelVersion, err = common.ExecCmd("uname", []string{"-r"}) if err != nil { return err } return nil }