package common

import "github.com/shirou/gopsutil/v4/common"

SPDX-License-Identifier: BSD-3-Clause

Index

Variables

var EnvKey = EnvKeyType("env")

EnvKey is a context key that can be used to set programmatically the environment gopsutil relies on to perform calls against the OS. Example of use:

ctx := context.WithValue(context.Background(), common.EnvKey, EnvMap{common.HostProcEnvKey: "/myproc"})
avg, err := load.AvgWithContext(ctx)

Types

type EnvKeyType

type EnvKeyType string
const (
	HostProcEnvKey    EnvKeyType = "HOST_PROC"
	HostSysEnvKey     EnvKeyType = "HOST_SYS"
	HostEtcEnvKey     EnvKeyType = "HOST_ETC"
	HostVarEnvKey     EnvKeyType = "HOST_VAR"
	HostRunEnvKey     EnvKeyType = "HOST_RUN"
	HostDevEnvKey     EnvKeyType = "HOST_DEV"
	HostRootEnvKey    EnvKeyType = "HOST_ROOT"
	HostProcMountinfo EnvKeyType = "HOST_PROC_MOUNTINFO"
)

type EnvMap

type EnvMap map[EnvKeyType]string

Source Files

env.go

Version
v4.25.2 (latest)
Published
Feb 25, 2025
Platform
linux/amd64
Last checked
3 days ago

Tools for package owners.