Documentation
¶
Overview ¶
Package versionfile updates version references in configured files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnclosedBlockMarker is returned when an x-yeet-start-* block has no matching x-yeet-end. ErrUnclosedBlockMarker = errors.New("unclosed x-yeet-start block") // ErrNestedBlockMarker is returned when an x-yeet-start-* appears inside an already-open block. ErrNestedBlockMarker = errors.New("nested x-yeet-start inside open block") // ErrMarkerNoMatch is returned when an inline marker's line has no value matching the expected pattern. ErrMarkerNoMatch = errors.New("yeet marker on line without matching version pattern") // ErrNoMarkersFound is returned when a configured version file has no yeet markers at all. ErrNoMarkersFound = errors.New("file has no yeet markers") // ErrMarkerSchemeMismatch is returned when a marker's scope is not valid for the // configured versioning scheme (or, for CalVer, not present in the configured format). ErrMarkerSchemeMismatch = errors.New("yeet marker scope not valid for configured scheme") // ErrInvalidNextVersion is returned when the next version cannot be parsed under the configured scheme. ErrInvalidNextVersion = errors.New("invalid next version") )
Functions ¶
func ApplyGenericMarkers ¶
ApplyGenericMarkers applies yeet marker-based version replacements to file content. It returns the updated content, whether anything changed, and an error describing any structural problem (unclosed/nested blocks, inline markers without a matching pattern, markers with a scope not valid for the scheme, or a file with no markers at all).
Types ¶
type Scheme ¶ added in v0.8.0
type Scheme struct {
// contains filtered or unexported fields
}
Scheme tells ApplyGenericMarkers which marker scopes are valid and how to extract token values from the next-version string. Use SemVerScheme or CalVerScheme to construct.
func CalVerScheme ¶ added in v0.8.0
func CalVerScheme(calver *version.CalVerScheme) Scheme
CalVerScheme returns the scheme for CalVer repositories using the given compiled CalVer format. The compiled format is reused across files so the caller pays the compilation cost once per target.
func SemVerScheme ¶ added in v0.8.0
func SemVerScheme() Scheme
SemVerScheme returns the scheme for SemVer repositories.