envutil

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package envutil provides utility functions for working with environment variables.

Index

Constants

View Source
const (
	SIMD_AVX512_Env = "GOMLX_SIMD_AVX512"
	SIMD_AVX2_Env   = "GOMLX_SIMD_AVX2"
)

Environment variables to control usage of SIMD instructions. By default it uses whatever the CPU supports, but this allows one to disable them in case of issues.

Variables

View Source
var (
	FalseValues = sets.MakeWith("0", "false", "f", "no", "off", "disabled")
	TrueValues  = sets.MakeWith("1", "true", "t", "yes", "on", "enabled")
)

Functions

func MustReadBool

func MustReadBool(name string, defaultValue bool) bool

MustReadBool reads the boolean value of the environment variable with the given name. If not set, it returns the defaultValue.

It panics with an informative error if the value is set but it is not able to parse a valid boolean value.

func ReadBool

func ReadBool(name string, defaultValue bool) (bool, error)

ReadBool reads the boolean value of the environment variable with the given name. If not set, it returns the defaultValue. It returns an error if the value is set but not a valid boolean value.

func ReadInt

func ReadInt(name string, defaultValue int) (int, error)

ReadInt reads the integer value of the environment variable with the given name. If not set, it returns the defaultValue. It returns an error if the value is set but not a valid integer value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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