swift

package
v0.3.21 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package swift resolves Swift toolchain versions from the official swift.org release index. The index is a single, anonymous JSON listing of every release, each entry carrying its tag, publication date, and per-platform SDK checksums for free, so the provider fetches it once and lets the framework own selection.

The entry name is the bare version (5.10, 6.3.3), matching a bare on-line reference, while the tag (swift-6.3.3-RELEASE) is the upstream ref the Linker resolves to a web page.

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 Swift toolchain versions from swift.org's public, unauthenticated release index. The index is a single JSON listing of every release, so the provider fetches it once and lets the framework own selection; it lists candidates and tags each with the publication date and SDK checksums the index returns for free, which cooldown and followers consume.

func New

func New(opts ...Option) *Provider

New returns the Swift provider. The release 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) Color

func (p *Provider) Color(dark bool) color.Color

Color is the provider's brand color. See provider.Provider.Color.

func (*Provider) Dated

func (p *Provider) Dated()

Dated marks the listing as date-bearing: every release carries a publication date, so cooldown applies.

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 Swift versions, reading the release index in one fetch. The index holds the whole release history in a single response, so there is no pagination and nothing is ever left unread - --deep has no work to do here.

func (*Provider) Identify

func (p *Provider) Identify(r provider.Resource) (string, string)

Identify names the Swift toolchain and its home page.

func (*Provider) Keys

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

Keys reports the directive keys the provider accepts. swift.org needs none of its own: the whole index arrives in one fetch with no scoping options.

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 Swift resource. swift.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 tag's page on the upstream repository. The tag wears both a prefix and a suffix, which only a discovered candidate's Ref carries - the synthesized current-version candidate arrives bare, since the pipeline reconstructs only a v-style prefix - so the ref is normalized to its bare core and the full tag is rebuilt here. Empty when the version is unknown.

Jump to

Keyboard shortcuts

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