environment

package
v0.0.0-...-ef2c00d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvironment

func GetEnvironment() []string

GetEnvironment returns the current environment variables as a slice of strings.

func GetGroups

func GetGroups() ([]string, error)

GetGroups retrieves the names of the groups that the current user belongs to. It returns a slice of strings representing the group names and an error if any.

func GetUsername

func GetUsername() (string, error)

GetUsername returns the username of the current user. It retrieves the current user using the user.Current() function. If an error occurs while getting the current user, it returns an empty string and the error.

Types

type OSInfo

type OSInfo struct {
	Platform      string
	Family        string
	Version       string
	KernelVersion string
}

func GetOSInfo

func GetOSInfo() (OSInfo, error)

GetOSInfo retrieves information about the operating system. It returns an OSInfo struct containing the platform, family, version, and kernel version of the operating system. If an error occurs during the retrieval of the information, it returns an empty OSInfo struct and the error.

type SystemInfo

type SystemInfo struct {
	TotalMemory int64
	CPUModel    string
	CPUCores    int32
}

func GetSystemInfo

func GetSystemInfo() SystemInfo

GetSystemInfo retrieves information about the system. It returns a SystemInfo struct containing the total memory in gigabytes, the CPU model name, and the number of CPU cores.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL