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

envcompat

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package envcompat keeps the pre-rename LEOFLOW_* environment variables and their DEXAFLOW_* names interchangeable.

Every binary calls Mirror before reading its configuration. Afterwards both spellings of every variable hold the same value, so code (and older agents, task images and scripts) that reads LEOFLOW_* and documentation that says DEXAFLOW_* agree. Child processes inherit the mirrored environment.

Index

Constants

View Source
const LegacyPrefix = "LEOFLOW_"

LegacyPrefix is the prefix before the rename. It keeps working.

View Source
const NewPrefix = "DEXAFLOW_"

NewPrefix is the environment variable prefix since the Dexaflow rename.

Variables

This section is empty.

Functions

func Lookup added in v0.5.4

func Lookup(suffix string) (string, bool)

Lookup returns the value of the variable named NewPrefix+suffix, else of LegacyPrefix+suffix, and whether either holds a non-empty value. It reads the process environment directly, so it agrees with Mirror without depending on the binary having called it: a CLI command run from a test, or embedded in another program, sees the same answer.

Types

type Report

type Report struct {
	// Legacy holds the variables set only under their LEOFLOW_* name.
	Legacy []string
	// Conflicts holds the variables set under both names with different values.
	Conflicts []string
	// Failed holds the variables Mirror could not write, with the reason.
	Failed []string
}

Report lists what Mirror found, by legacy variable name.

func Mirror

func Mirror(environ []string, set func(key, value string) error) Report

Mirror makes every NewPrefix variable and its LegacyPrefix counterpart hold the same value, writing through set. When both are present and differ, the NewPrefix value wins.

func MirrorProcess

func MirrorProcess() Report

MirrorProcess applies Mirror to the current process environment.

func (Report) ConflictNotes

func (r Report) ConflictNotes() []string

ConflictNotes renders one line per conflicting pair.

func (Report) Notes

func (r Report) Notes() []string

Notes renders the report as one human-readable line per finding.

Jump to

Keyboard shortcuts

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