Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OSInfo ¶
OSInfo represents the operating system information, including its name, distribution, version, and architecture.
func GetOSInfo ¶
GetOSInfo returns the OS information, as a pointer to an OSInfo struct. The OSInfo struct contains the following fields:
- Name: OS name (ex, linux, darwin, windows)
- Distribution: OS distribution (ex, Ubuntu)
- Version: OS version (ex, 20.04)
- Arch: OS architecture (ex, amd64)
Example ¶
ExampleGetOSInfo demonstrates how to use the GetOSInfo function to obtain information about the operating system.
package main
import (
"fmt"
"github.com/bluet/syspkg/osinfo"
)
func main() {
osInfo, err := osinfo.GetOSInfo()
if err != nil {
fmt.Println("Error getting OS info:", err)
return
}
fmt.Println("Name:", osInfo.Name)
fmt.Println("Distribution:", osInfo.Distribution)
fmt.Println("Version:", osInfo.Version)
fmt.Println("Architecture:", osInfo.Arch)
}
Click to show internal directories.
Click to hide internal directories.