Help us shape the future of Go! Take the 2026 Go Developer Survey

env

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

type Source struct {
	Prefix string
}

Source implements the dials.Source interface to set configuration from environment variables.

func (*Source) Value

func (e *Source) Value(_ context.Context, t *dials.Type) (reflect.Value, error)

Value fills in the user-provided config struct using environment variables. It looks up the environment variable to read into a given struct field by using that field's `dialsenv` struct tag if present, then its `dials` tag if present, and finally its name. If the struct field's name is used, Value assumes the name is in Go-style camelCase (e.g., "JSONFilePath") and converts it to UPPER_SNAKE_CASE. (The casing of `dialsenv` and `dials` tags is left unchanged.)

Jump to

Keyboard shortcuts

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