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

toolenv

package
v0.0.112 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: 17 Imported by: 0

Documentation

Overview

Package toolenv prepares retained, version-isolated packages and native build environments. Preparation never changes the worker's process environment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NixSystem

func NixSystem() (string, error)

Types

type Diagnostics

type Diagnostics struct {
	TaskOrdinal *int64                `json:"task_ordinal,omitempty"`
	WallMS      int64                 `json:"wall_ms"`
	Tools       []ToolDiagnostic      `json:"tools,omitempty"`
	Error       string                `json:"error,omitempty"`
	Repository  *RepositoryDiagnostic `json:"repository,omitempty"`
	Native      *NativeDiagnostic     `json:"native,omitempty"`
}

type Environment

type Environment struct {
	Path      string             `json:"path"`
	Tools     []Tool             `json:"tools"`
	Variables map[string]string  `json:"variables,omitempty"`
	Native    *nativeEnvironment `json:"native,omitempty"`
}

func (Environment) Bind added in v0.0.108

Bind applies both executable selection and native activation to one op.

func (Environment) Ready

func (e Environment) Ready() bool

Ready is strictly local and read-only. False means return to setup, never install or resolve a package inside the task's execution budget.

type Manager

type Manager struct{ Root string }

Manager owns only a local cache. Providers can retain/mount Root at the same absolute path. Package managers and their runtimes must exist in the base.

func Default

func Default() (*Manager, error)

func (*Manager) Prepare

func (m *Manager) Prepare(ctx context.Context, scopes []Scope) (env Environment, diag Diagnostics, err error)

Prepare resolves each declaration on first use, sharing completed entries across scopes/invocations. No manager runs on a warm hit.

func (*Manager) PrepareNixPackage

func (m *Manager) PrepareNixPackage(ctx context.Context, p NixPackage) (root string, reused bool, err error)

PrepareNixPackage realizes only the pinned output, with a retained GC root. It never re-evaluates the original selector or builds missing outputs.

type NativeDiagnostic added in v0.0.108

type NativeDiagnostic struct {
	Identity string `json:"identity"`
	Outcome  string `json:"outcome"`
	WallMS   int64  `json:"wall_ms"`
}

type NixPackage

type NixPackage struct {
	StorePath string          `json:"store_path"`
	System    string          `json:"system"`
	Manifest  json.RawMessage `json:"manifest"`
}

NixPackage is evaluation metadata, not an installed package. StorePath pins realization to exactly the output described by Manifest, even if a ref moves.

func DescribeNixPackage

func DescribeNixPackage(ctx context.Context, reference, baseDir string) (*NixPackage, error)

DescribeNixPackage evaluates passthru.c2j and the output identity together. Import-from-derivation is forbidden: metadata inspection cannot realize code.

func (NixPackage) Validate

func (p NixPackage) Validate() error

type RepositoryDiagnostic added in v0.0.108

type RepositoryDiagnostic struct {
	config.PackageSource
	Scope      string `json:"scope"`
	Repository string `json:"repository,omitempty"`
	Snapshot   string `json:"snapshot,omitempty"`
}

type Scope

type Scope struct {
	ID       string   `json:"id"`
	Packages []string `json:"packages"`
}

type Tool

type Tool struct {
	Reference   string   `json:"reference"`
	Bin         string   `json:"bin"`
	Executables []string `json:"executables"`
	Main        string   `json:"main,omitempty"`
	Identity    string   `json:"identity"`
	Nix         *nixTool `json:"nix,omitempty"`
}

type ToolDiagnostic

type ToolDiagnostic struct {
	Reference string `json:"reference"`
	Identity  string `json:"identity,omitempty"`
	Scope     string `json:"scope"`
	WallMS    int64  `json:"wall_ms"`
	Outcome   string `json:"outcome"`
}

Jump to

Keyboard shortcuts

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