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

profile

package
v0.38.0 Latest Latest
Warning

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

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

Documentation

Overview

Package profile provides named configurations. Each non-default profile reads its values from its own file, so profiles do not share values. A Registry finds profiles by name.

Index

Constants

View Source
const DefaultName = "default"

DefaultName is the name of the default profile, whose configuration is the base configuration of the registry.

Variables

View Source
var ErrCorrupt = errors.New("profile file is not valid")

ErrCorrupt is returned when a profile file exists but is not a valid configuration file.

View Source
var ErrInvalidName = errors.New("invalid profile name")

ErrInvalidName is returned when a profile name is not allowed.

View Source
var ErrNotFound = errors.New("profile not found")

ErrNotFound is returned when a profile does not exist.

Functions

This section is empty.

Types

type Profile

type Profile interface {
	// Name is the profile's name.
	Name() string
	// Configuration holds the profile's values. The same instance is returned on every call.
	Configuration() configuration.Configuration
}

Profile is one named profile.

type Registry

type Registry interface {
	// Profile returns the profile with the given name, or ErrNotFound if it does not exist.
	Profile(name string) (Profile, error)
}

Registry finds profiles by name.

func NewFileRegistry

func NewFileRegistry(baseDir string, base configuration.Configuration) (Registry, error)

NewFileRegistry returns a registry that reads each profile from baseDir/profiles/<name>.json. The default profile is base itself, and every other profile is derived from base. baseDir must be absolute, otherwise a profile would fall back to the default storage.

Jump to

Keyboard shortcuts

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