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 ¶
const ConfigKey = "answer.upstreams"
ConfigKey is where the declarations live in configuration.
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 ¶
var ErrInvalid = errors.NewSentinel("upstream.invalid", "upstream: invalid declaration")
ErrInvalid is a declaration that cannot be used.
Functions ¶
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).
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.