zig

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package zig resolves Zig toolchain versions from the official ziglang.org download index. The index is a single, anonymous JSON object keyed by version, each entry carrying its per-platform archive checksums and publication date for free, so the provider fetches it once and lets the framework own selection.

The index key is the authoritative version: recent entries also carry a redundant "version" field, but older releases omit it, so the provider always reads the key. The "master" key is a moving nightly pointer, not a release, and is skipped.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Provider)

Option configures a Provider.

func WithTransport

func WithTransport(rt http.RoundTripper) Option

WithTransport overrides the HTTP transport, for tests.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider resolves Zig toolchain versions from ziglang.org's public, unauthenticated download index. The index is a single JSON object listing every release, so the provider fetches it once and lets the framework own selection; it lists candidates and tags each with the archive checksums and publication date the index returns for free, which followers and cooldown consume.

func New

func New(opts ...Option) *Provider

New returns the Zig provider. The download index is public and publishes no rate-limit headers, so the client is a plain cached one with no ratelimit wrapper or credentials.

func (*Provider) Dated

func (p *Provider) Dated()

Dated marks the listing as date-bearing: a tagged release carries a publication date. An entry without one falls to the post-discovery date check.

func (*Provider) Describe

func (p *Provider) Describe(r provider.Resource) string

Describe returns a human-readable label for a resource.

func (*Provider) Discover

func (p *Provider) Discover(ctx context.Context, r provider.Resource) ([]model.Candidate, error)

Discover lists candidate Zig versions, reading the download index in one fetch. The index holds the whole release history in a single object keyed by version, so there is no pagination and nothing is ever left unread - --deep has no work to do here. The map iteration order is nondeterministic, so candidates are returned unordered; selection sorts regardless.

func (*Provider) Keys

func (p *Provider) Keys() []provider.Key

Keys reports the directive keys the provider accepts. ziglang.org needs none of its own: the whole index arrives in one fetch, and per-platform checksum selection is a follower's job via its pattern, not a provider option.

func (*Provider) Name

func (p *Provider) Name() string

Name identifies the provider.

func (*Provider) Resource

func (p *Provider) Resource(_ directive.Directive) (provider.Resource, error)

Resource validates a directive into a Zig resource. ziglang.org takes no provider-specific keys, so every directive resolves to the same descriptor.

func (*Provider) URL

URL builds the web page for a resolved candidate: the release's file directory on ziglang.org (e.g. .../download/0.16.0/). The version is clean semver and is also the upstream ref, so the current-version candidate - whose Version is the bare on-line value - links correctly with no Meta. Empty when the version is unknown.

Jump to

Keyboard shortcuts

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