toolchain

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package toolchain provides an abstraction layer for developer tooling that can be installed in the container image at build time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear()

Clear removes all toolchains from the registry. This function is primarily intended for testing.

func DetectToolchains

func DetectToolchains(workspacePath string) []string

DetectToolchains examines the workspace directory for files that indicate which toolchains are needed. Returns a deduplicated, sorted list of toolchain names.

Only returns names of toolchains that are registered in the registry. Returns nil for nonexistent directories.

func Exists

func Exists(name string) bool

Exists returns true if a toolchain with the given name exists in the registry. This function is safe for concurrent use.

func Names

func Names() []string

Names returns the names of all registered toolchains, sorted alphabetically. This function is safe for concurrent use.

func Register

func Register(tc Toolchain)

Register adds a toolchain to the global registry. If a toolchain with the same name already exists, it is replaced. This function is safe for concurrent use.

Types

type Toolchain

type Toolchain interface {
	// Name returns the unique identifier (e.g., "node", "go").
	Name() string

	// DisplayName returns the human-readable name (e.g., "Node.js", "Go").
	DisplayName() string

	// Packages returns Alpine packages to install via apk add.
	Packages() []string

	// InstallCommands returns shell commands to run after apk install.
	// Each string becomes a separate RUN instruction. Return nil if
	// apk packages are sufficient.
	InstallCommands() []string

	// EnvVars returns environment variables to bake into the image
	// (e.g., "GOPATH=/home/dev/go"). Return nil if none needed.
	EnvVars() []string

	// PathEntries returns directories to prepend to PATH.
	// Return nil if none needed.
	PathEntries() []string
}

Toolchain defines the interface for installable developer tooling.

func Get

func Get(name string) Toolchain

Get retrieves a toolchain by name from the registry. Returns nil if no toolchain with the given name exists. This function is safe for concurrent use.

func List

func List() []Toolchain

List returns all registered toolchains, sorted alphabetically by name. This function is safe for concurrent use.

Jump to

Keyboard shortcuts

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