23 lines
479 B
Go
23 lines
479 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/shirou/gopsutil/v4/host"
|
|
)
|
|
|
|
func main() {
|
|
hostInfo, err := host.Info()
|
|
if err != nil {
|
|
fmt.Printf("Error: %v\n", err)
|
|
return
|
|
}
|
|
|
|
fmt.Printf("Hostname: %s\n", hostInfo.Hostname)
|
|
fmt.Printf("OS: %s\n", hostInfo.OS)
|
|
fmt.Printf("Platform: %s\n", hostInfo.Platform)
|
|
fmt.Printf("OS Version: %s\n", hostInfo.PlatformVersion)
|
|
fmt.Printf("Kernel: %s\n", hostInfo.KernelVersion)
|
|
fmt.Printf("Uptime: %d seconds\n", hostInfo.Uptime)
|
|
}
|