Documentation
¶
Overview ¶
Package tag parses and evaluates the --tag marker filter. A marker carries its own labels (tags=prod,ci); a filter built from one or more --tag values decides which markers a run touches. Within a single --tag value, "/" separates OR alternatives and "," separates AND requirements, and a "!" prefix excludes a tag; repeated values accumulate. The filter is pure and the rendering is human-readable, so the CLI can log exactly what it will act on.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
Filter selects markers by tag. A marker matches when it carries none of Not (exclusions veto), every tag in All (AND), and at least one tag in Any (OR). An empty list drops that requirement, so the zero Filter matches everything. Matching is case-insensitive.
func Parse ¶
Parse builds a Filter from raw --tag values. A value containing "/" splits on it into OR alternatives; any other value splits on "," into AND requirements. A term prefixed with "!" is an exclusion, collected regardless of separator. Surrounding whitespace is trimmed and empty items dropped; repeated flags accumulate, so --tag a,b --tag c/d yields All=[a b], Any=[c d].
Mixing "," and "/" in a single value is ambiguous (AND-vs-OR precedence) and is rejected, rather than silently producing an unmatchable term; combine an AND set and an OR set by passing them as separate --tag values instead.
func (Filter) Empty ¶
Empty reports whether the filter constrains nothing, in which case every marker matches.
func (Filter) Match ¶
Match reports whether a marker carrying tags satisfies the filter. An empty filter matches everything. An exclusion vetoes a marker carrying that tag; an include requirement (All/Any) is never satisfied by an untagged marker, so a filter with includes targets exactly the tagged markers, while a pure-exclusion filter keeps everything except the excluded.