Documentation
¶
Overview ¶
Package version provides versioning strategies for calculating release versions.
Index ¶
Constants ¶
const DefaultCalVerFormat = "YYYY.0M.MICRO"
Variables ¶
var ErrInvalidVersion = errors.New("invalid version")
Functions ¶
func ValidateCalVerFormat ¶ added in v0.6.1
Types ¶
type CalVer ¶
CalVer implements calendar versioning. Supported formats use CalVer date tokens and a MICRO incrementing counter.
func (*CalVer) InitialVersion ¶
InitialVersion returns an empty string since calver starts from the current date.
type CalVerScheme ¶ added in v0.8.0
type CalVerScheme struct {
// contains filtered or unexported fields
}
CalVerScheme is a compiled CalVer format ready to extract per-token values from a version string. Construct via NewCalVerScheme; treat as opaque.
func NewCalVerScheme ¶ added in v0.8.0
func NewCalVerScheme(format string) (*CalVerScheme, error)
NewCalVerScheme compiles the format once and returns a reusable scheme. The empty string compiles to DefaultCalVerFormat.
func (*CalVerScheme) Format ¶ added in v0.8.0
func (s *CalVerScheme) Format() string
Format returns the raw format string the scheme was compiled from.
func (*CalVerScheme) HasDay ¶ added in v0.8.0
func (s *CalVerScheme) HasDay() bool
HasDay reports whether the format addresses a day component.
func (*CalVerScheme) HasMonth ¶ added in v0.8.0
func (s *CalVerScheme) HasMonth() bool
HasMonth reports whether the format addresses a month component.
func (*CalVerScheme) HasWeek ¶ added in v0.8.0
func (s *CalVerScheme) HasWeek() bool
HasWeek reports whether the format addresses a week component.
func (*CalVerScheme) MarkerValues ¶ added in v0.8.0
func (s *CalVerScheme) MarkerValues(version string) (map[MarkerToken]string, error)
MarkerValues parses a CalVer-shaped version string and returns rendered strings for each addressable token, keyed by canonical token name. Widths match the format's tokens (e.g. 0M zero-pads to 2). Tokens not present in the format are absent from the map.
type MarkerToken ¶ added in v0.8.0
type MarkerToken string
MarkerToken names the addressable components of a parsed version string. Marker-based version-file updaters use these to look up the rendered value for a given file marker (e.g. x-yeet-month).
const ( MarkerTokenYear MarkerToken = "year" MarkerTokenMonth MarkerToken = "month" MarkerTokenWeek MarkerToken = "week" MarkerTokenDay MarkerToken = "day" MarkerTokenMicro MarkerToken = "micro" )