os
Description
Operating system information
Fields
| ID | TYPE | DESCRIPTION |
|---|---|---|
| name | string | Pretty hostname on macOS/Linux or device name on Windows |
| env | map[string]string | ENV variable contents |
| path | []string | PATH variable contents |
| uptime | time | Current uptime |
| updates | []os.update | List of available OS updates |
| rebootpending | bool | Whether a reboot is pending |
| hostname | string | Hostname for this OS |
| hypervisor | string | Hypervisor for this OS |
| machineid | string | Machine ID for this OS |
Examples
Show all environment variables
os.env
Retrieve a single environment variable
os.env['windir']