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

kit

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package kit names a product built on lockkit. Every lockkit package that needs a name, an account, a directory or an environment variable takes a Product instead of a literal, so two products on one machine never share a socket, a config directory or a keychain service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StateBase

func StateBase() (string, error)

StateBase is the per-user state directory every product's StateDir is under: $XDG_STATE_HOME or ~/.local/state on Linux, the user config dir on macOS.

Types

type Product

type Product struct {
	// Name is the binary name and the directory name under every config,
	// state and runtime directory ("locksql").
	Name string
	// Tagline is the line under the name in the banner.
	Tagline string
	// Account is the dedicated console account ("locksql").
	Account string
	// ClientsGroup's members may reach the console ("locksql-clients").
	ClientsGroup string
	// KeychainService names every OS keychain item of the product.
	KeychainService string
	// EnvPrefix prefixes the product's environment variables ("LOCKSQL_").
	EnvPrefix string
	// Version is the product's version, without a leading v.
	Version string
}

Product is the identity of a product: its names on the machine.

func (Product) Env

func (p Product) Env(suffix string) string

Env is the name of the product's environment variable suffix ("RUNTIME_DIR" → "LOCKSQL_RUNTIME_DIR").

func (Product) ProjectDir

func (p Product) ProjectDir() string

ProjectDir is the project directory name: "." + Name.

func (Product) RuntimeDir

func (p Product) RuntimeDir() (string, error)

RuntimeDir is the private directory of the user's console sockets: $<prefix>RUNTIME_DIR/Name when set, else $XDG_RUNTIME_DIR/Name (Linux) or $TMPDIR/Name (macOS), else /tmp/Name-<uid>.

func (Product) RuntimeDirEnv

func (p Product) RuntimeDirEnv() string

RuntimeDirEnv is the variable that overrides the runtime dir on every OS when set to an absolute path: the sockets then live in $<prefix>RUNTIME_DIR/Name.

func (Product) SharedSocketDir

func (p Product) SharedSocketDir() string

SharedSocketDir is the default socket directory of a separated setup.

func (Product) StateDir

func (p Product) StateDir() (string, error)

StateDir is StateBase()/Name: approved policies, audit log, caches.

func (Product) SystemConfigPath

func (p Product) SystemConfigPath() string

SystemConfigPath is the machine-wide setup file: /etc/Name/system.toml.

func (Product) UserConfigDir

func (p Product) UserConfigDir() (string, error)

UserConfigDir is <user config dir>/Name.

func (Product) Validate

func (p Product) Validate() error

Validate reports a product whose names cannot be used safely.

Jump to

Keyboard shortcuts

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