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

http

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package http resolves versions from an arbitrary HTTP endpoint, the escape hatch for any source clover has no bespoke provider for. It fetches a user-supplied url once, anonymously, and extracts one-or-many version strings from the response - a jq program over a JSON body, or a glob/regex over a text body - leaving the framework to own selection. The extraction expression is compiled at validation time, so clover lint catches a malformed jq or pattern offline before any fetch.

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 nethttp.RoundTripper) Option

WithTransport overrides the HTTP transport, for tests.

func WithVersion

func WithVersion(version string) Option

WithVersion sets the clover version woven into the default User-Agent. The composition root passes the running binary's version; an empty value keeps the bare product name.

type Provider

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

Provider resolves versions from an arbitrary HTTP endpoint. It performs one anonymous GET of the configured url and extracts candidate version strings from the response, leaving selection to the framework; it lists candidates and nothing more, so it carries no per-version metadata.

func New

func New(opts ...Option) *Provider

New returns the http provider. The endpoint is fetched anonymously through the shared cache, with no ratelimit wrapper or credentials.

func (*Provider) Color added in v0.3.10

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

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

func (*Provider) Describe

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

Describe returns a human-readable label for a resource: the endpoint's host.

func (*Provider) Discover

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

Discover fetches the endpoint once and extracts candidate versions from the response. There is no pagination - a single response holds whatever the endpoint serves - so nothing is ever left unread.

func (*Provider) Identify added in v0.3.10

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

Identify returns the endpoint host and the tracked URL.

func (*Provider) Keys

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

Keys reports the directive keys http accepts, in canonical order. The two extraction keys are mutually exclusive; Resource enforces that exactly one is set, so neither carries the Required flag.

func (*Provider) Name

func (p *Provider) Name() string

Name identifies the provider.

func (*Provider) Resource

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

Resource validates a directive into an http resource: a required url and exactly one extraction key, whose expression is compiled here so a malformed jq or pattern fails validation (and lint) rather than mid-fetch.

Jump to

Keyboard shortcuts

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