calver

package
v0.2026323.242 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 3 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 format is used for the binary's stamped build identity (charly version) and for git release/candy tags. Nothing compares an authored config against a build: the authored schema `version:` no longer exists.

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 — a 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 treated by the freshness comparison as "older than every real CalVer".

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

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