upstream

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package upstream signposts a question that belongs to a project's upstream, such as FFmpeg for ffmpeg-wasi, which the bot never indexes and never answers for (spec 0036).

Index

Constants

View Source
const ConfigKey = "answer.upstreams"

ConfigKey is where the declarations live in configuration.

View Source
const VersionFromTag = "tag"

VersionFromTag reads the upstream's version from the wrapper's release tag, without its build suffix: n9.0.1-8 gives n9.0.1.

Variables

View Source
var ErrInvalid = errors.NewSentinel("upstream.invalid", "upstream: invalid declaration")

ErrInvalid is a declaration that cannot be used.

Functions

func Reload

func Reload(log *slog.Logger, s *Signposter) func(config.Observed) error

Reload is the config observer that swaps the declarations on a change, or keeps them and logs why when the change does not validate (D5).

Types

type Declaration

type Declaration struct {
	Upstream string   `mapstructure:"upstream" yaml:"upstream"`
	Aliases  []string `mapstructure:"aliases" yaml:"aliases"`

	// Wrapper is the wrapping project's source path; Names are what a question
	// calls it, the first printed in the line.
	Wrapper string   `mapstructure:"wrapper" yaml:"wrapper"`
	Names   []string `mapstructure:"names" yaml:"names"`

	// Terms are words that make a question naming the wrapper an upstream one.
	Terms []string `mapstructure:"terms" yaml:"terms"`

	Docs string `mapstructure:"docs" yaml:"docs"`

	// Version is the upstream's Go module path, read from the wrapper release's
	// go.mod, or VersionFromTag, or empty for no version (D7).
	Version string `mapstructure:"version" yaml:"version"`
}

Declaration says which upstream a wrapper is built on and where its documentation is (D5).

func Load

func Load(cfg config.Reader) ([]Declaration, error)

Load reads and validates the declarations under ConfigKey; none is not an error.

type Signposter

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

Signposter turns a question into signposts, from declarations swapped whole on a reload.

func FromConfig

func FromConfig(cfg config.Reader, versions Versions) (*Signposter, error)

FromConfig builds a signposter from answer.upstreams, refusing a declaration that does not validate (D5).

func NewSignposter

func NewSignposter(ds []Declaration, versions Versions) *Signposter

NewSignposter signposts from ds, which Load has validated, with versions from the index.

func (*Signposter) Signposts

func (s *Signposter) Signposts(ctx context.Context, question string) []answer.Signpost

Signposts implements answer.Signposter.

type Versions

type Versions interface {
	Requires(ctx context.Context, wrapper string) (index.Requires, bool)
}

Versions reads what the index recorded about a wrapper's release.

Jump to

Keyboard shortcuts

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