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

toolchain

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package toolchain resolves and installs tools selected by a project's pinned SDK.

Package toolchain resolves tools selected by a project's pinned SDK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureHost

func EnsureHost(ctx context.Context, manifest sdk.Manifest, target string) (string, error)

EnsureHost installs the host selected by the project SDK when that SDK publishes a checksum-pinned release artifact.

func EnsureMaterialize added in v0.0.2

func EnsureMaterialize(ctx context.Context, manifest sdk.Manifest, override string) (string, error)

EnsureMaterialize selects only SDK-pinned release binaries or an explicit executable override. It never searches PATH, builds source or executes tools.

func Go

func Go(ctx context.Context, options GoOptions) (string, error)

Go resolves the Go compiler from an explicit override, environment, or PATH.

func Host

func Host(version, target string) (string, error)

Host locates a cached host. EnsureHost verifies its SDK-pinned checksum.

func InstallHost

func InstallHost(ctx context.Context, version, target string, artifact sdk.ToolArtifact) (string, error)

InstallHost downloads, verifies, and atomically installs a raw host artifact.

func InstallMaterialTool added in v0.0.2

func InstallMaterialTool(ctx context.Context, options InstallMaterialToolOptions) (string, error)

InstallMaterialTool installs only the explicitly supplied verified binary. It never invokes a compiler, executes downloaded code, or resolves PATH. The verified archive is retained to recheck every file on warm installs; damaged caches fail closed and must be removed before reinstalling.

func InstallTinyGo

func InstallTinyGo(ctx context.Context, options InstallTinyGoOptions) (string, error)

InstallTinyGo downloads, verifies, and atomically installs TinyGo.

func InstallWasmTools

func InstallWasmTools(ctx context.Context, options InstallWasmToolsOptions) (string, error)

InstallWasmTools downloads, verifies, and atomically installs wasm-tools.

func NativeHostName added in v0.0.2

func NativeHostName(platform string) string

NativeHostName uses the destination OS, not the build machine's OS.

func NativePlatform added in v0.0.2

func NativePlatform(platform string) (string, error)

NativePlatform validates a game distribution target independently of installed tools.

func TinyGo

func TinyGo(options TinyGoOptions) (string, error)

TinyGo returns the selected TinyGo executable. Selection order is explicit override, KARTY_TINYGO, then the CLI-managed user cache.

func WasmTools

func WasmTools(version string) (string, error)

WasmTools returns the SDK-pinned wasm-tools executable from the Karty cache.

Types

type EnsureOptions

type EnsureOptions struct {
	GoOverride          string
	TinyGoOverride      string
	WasmToolsOverride   string
	MaterializeOverride string
	NeedGo              bool
	NeedTinyGo          bool
	NeedWasmTools       bool
	NeedMaterialize     bool
}

EnsureOptions selects the SDK tools needed by a command. An explicit tool path is deliberately never downloaded or replaced.

type EnsurePaths

type EnsurePaths struct {
	Go          string
	TinyGo      string
	WasmTools   string
	Materialize string
}

EnsurePaths reports the resolved locations of tools that Ensure checked.

func Ensure

func Ensure(ctx context.Context, manifest sdk.Manifest, options EnsureOptions) (EnsurePaths, error)

Ensure verifies that the selected SDK tools are ready to run, downloading missing managed tools into the checksum-verified Karty cache. It does not download tools supplied through command-line or environment overrides.

type GoOptions

type GoOptions struct {
	Override string
	Version  string
	Getenv   func(string) string
}

GoOptions configures the Go compiler selection.

type InstallMaterialToolOptions added in v0.0.2

type InstallMaterialToolOptions struct {
	Spec     MaterialToolSpec
	CacheDir string
	Platform string // Empty selects runtime.GOOS + "-" + runtime.GOARCH.
	Download func(context.Context, string) (io.ReadCloser, error)
}

type InstallTinyGoOptions

type InstallTinyGoOptions struct {
	Version  string
	Artifact sdk.ToolArtifact
	CacheDir string
	Platform string
	Download func(context.Context, string) (io.ReadCloser, error)
}

InstallTinyGoOptions identifies a TinyGo release and where to install it.

type InstallWasmToolsOptions

type InstallWasmToolsOptions struct {
	Version  string
	Artifact sdk.ToolArtifact
	CacheDir string
	Platform string
	Download func(context.Context, string) (io.ReadCloser, error)
}

InstallWasmToolsOptions identifies a wasm-tools release and where to install it.

type MaterialTool added in v0.0.2

type MaterialTool string

MaterialTool identifies a binary tool, not a source build or the Unity editor.

const (
	MaterialToolMaterialize MaterialTool = "materialize-cli" // AiGameKit Materialize Rust CLI.
)

type MaterialToolArtifact added in v0.0.2

type MaterialToolArtifact struct {
	URL        string
	SHA256     string
	Format     string // "zip"; never inferred from the URL.
	Executable string
}

MaterialToolArtifact describes a publisher-supplied, checksum-pinned archive. Executable is its exact slash-separated member path; all other regular files (including licenses and notices) are preserved alongside it.

type MaterialToolSpec added in v0.0.2

type MaterialToolSpec struct {
	Tool      MaterialTool
	Revision  string
	Artifacts map[string]MaterialToolArtifact
}

MaterialToolSpec pins a full Git commit and per-developer-platform artifacts. MaterializeSpec adapts optional released SDK pins to this installer contract; released SDKs select Materialize. No PATH fallback exists.

func MaterializeSpec added in v0.0.2

func MaterializeSpec(manifest sdk.Manifest) (MaterialToolSpec, error)

MaterializeSpec adapts a complete SDK pin without changing installer bounds. An absent pin is valid SDK metadata, but cannot select a managed installation.

type TinyGoOptions

type TinyGoOptions struct {
	Override string
	Version  string
	CacheDir string
	Getenv   func(string) string
}

TinyGoOptions supplies the supported TinyGo selection inputs.

Jump to

Keyboard shortcuts

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