calver

package
v0.2026269.138 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: MIT Imports: 4 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareCalVer

func CompareCalVer(a, b string) int

CompareCalVer compares two CalVer strings numerically component-by-component, falling back to lexical comparison for any non-numeric component. Returns -1 if a < b, +1 if a > b, 0 if equal. Distinct from ParsedCalVer.Less, which requires strictly-canonical parsed CalVers; this is the lenient dotted-string comparator the build/tag paths use. A leading "v" (the git-tag form) is stripped before comparison, so semver-style tags ("v1.2.3") sort correctly against multi-digit majors ("v10.0.0") — the single comparator for both CalVer and git-tag strings (refs.CompareSemver delegates here).

TWO TAG ENCODINGS, ONE TIMELINE. The org's Go-module repos (sdk, spec, plugin-gh) are tagged in Go's required semver form `v0.<YYYYDDD>.<HHMM>` (a leading-zero major, so it is a valid module version — semver forbids a leading-zero patch segment, so `0733`→`733`), while every other repo tags the plain CalVer `v<YYYY>.<DDD>.<HHMM>`. A repo mid-migration carries BOTH forms, and a naive component-wise compare ranks the Go form's major `0` below the plain form's `2026`, so the STALE plain tag wins over a NEWER Go-form tag (measured: plugin-gh `v2026.252.1501` beat `v0.2026266.2326`; spec `v2026.240.1944` beat `v0.2026266.2126`). normalizeCalVer maps the Go form back onto the canonical `<YYYY>.<DDD>.<HHMM>` tuple so both forms sort on ONE timeline; it is a no-op for the plain form and for any genuine semver ("v1.2.3"), so those keep their existing component-wise semantics.

Types

type ParsedCalVer

type ParsedCalVer struct {
	Year int // calendar year (e.g. 2026)
	Day  int // day of year, 1-366
	HHMM int // hour*100 + minute, 0-2359
}

ParsedCalVer is a parsed YYYY.DDD.HHMM calendar version. The same format that ComputeCalVer emits for image tags is, since the 2026-05 schema-versioning cutover, the schema-version stamp carried by every versioned YAML config. The declarative migration table is ordered by ParsedCalVer, and the load-time gate compares a file's version against LatestSchemaCalVer.

func LatestSchemaCalVer

func LatestSchemaCalVer() ParsedCalVer

LatestSchemaCalVer is the HEAD schema CalVer (parsed) — every current-format versioned file is stamped to it and the load-time gate requires it. Named distinctly from the SchemaVersion string const it parses; sdk/kit re-exports it as kit.LatestSchemaVersion.

func MustCalVer

func MustCalVer(s string) ParsedCalVer

MustCalVer parses a compile-time-constant CalVer literal, panicking on a malformed value. Used for the CUE-owned HEAD/floor consts (SchemaVersion / SchemaFloor), so a non-canonical literal that slipped past the strict #CanonCalVer CUE gate still fails fast at process start rather than silently mis-ordering the migration table.

func ParseCalVer

func ParseCalVer(s string) (ParsedCalVer, bool)

ParseCalVer parses the CANONICAL CalVer string "YYYY.DDD.HHMM" — exactly a 4-digit year, a 3-digit zero-padded day-of-year, and a 4-digit zero-padded HHMM, separated by dots. It is EXTREMELY STRICT and has NO backward compatibility: every component must be the exact width, pure ASCII digits (no sign, no inner whitespace), within range (day 1-366, hour 0-23, minute 0-59). Anything else — the legacy integer "4", a non-padded "2026.45.830", an empty string, junk — returns ok=false. (Surrounding whitespace, a transport artifact of e.g. a `charly version` trailing newline, is trimmed before the format check.)

A false result is exactly what the schema gate and migration runner treat as "older than every real CalVer", so a non-canonical config flows into `charly migrate` and is re-stamped canonical.

Because the canonical form is fixed-width zero-padded, a plain alphanumeric (lexicographic) sort of CalVer strings is chronological (see ParsedCalVer.Less).

func SchemaFloorCalVer

func SchemaFloorCalVer() ParsedCalVer

SchemaFloorCalVer is the oldest schema CalVer (parsed) `charly migrate` can migrate FROM. A config below it (or with a non-CalVer version) is unmigratable. Named distinctly from the SchemaFloor string const it parses; sdk/kit re-exports it as kit.SchemaFloor.

func (ParsedCalVer) Less

func (c ParsedCalVer) Less(o ParsedCalVer) bool

Less reports whether c is chronologically before o. Because the canonical string form is fixed-width zero-padded, chronological order IS lexicographic order, so this is a plain string comparison.

func (ParsedCalVer) String

func (c ParsedCalVer) String() string

String renders the canonical CalVer "YYYY.DDD.HHMM" — 4-digit year, 3-digit zero-padded day, 4-digit zero-padded HHMM. This is the ONLY form ParseCalVer accepts, so String∘Parse is the identity and a plain alphanumeric sort of these strings is chronological.

Jump to

Keyboard shortcuts

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