tagfmt

package
v0.30.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 4 Imported by: 0 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 DeriveHeadingVersionPattern added in v0.20.0

func DeriveHeadingVersionPattern(template string) string

DeriveHeadingVersionPattern returns a git-cliff postprocessor regex that strips every non-{version} token (env prefix/suffix and build) from a changelog version heading, leaving only the version. The replacement is "[$1]". Examples:

{version}_{env}          [2026.3.0_prod]      → [2026.3.0]
{env}/{version}-{build}  [uat/7.4.1-158404]   → [7.4.1]
{env}/{version}          [prod/1.2.3]         → [1.2.3]

Returns "" when there is nothing to strip — no {version}, or neither {env} nor {build} present (a plain or "v"-prefixed version heading is already clean).

All wildcards exclude "]" so a match can never span two headings (postprocessors run against the whole rendered document). The greedy version capture plus the anchored trailing token handle SemVer pre-release segments (e.g. 7.4.1-rc.1) under a "-" build separator without special-casing.

func DeriveTagPattern added in v0.20.0

func DeriveTagPattern(template, env string) string

DeriveTagPattern returns an anchored regex (for git-cliff --tag-pattern) that matches only the given environment's tags. {env} becomes the literal env, {version} and {build} become wildcards. Returns "" when the template has no {env} token or env is empty — there is nothing to scope in those cases.

func GlobPattern

func GlobPattern(template, env string) (string, error)

GlobPattern returns a git tag glob pattern for listing tags under the given env.

func ParseVersion

func ParseVersion(template, tag string) (string, error)

ParseVersion extracts the version string from a tag using the given template.

func Render

func Render(template, env, version, build string) (string, error)

Render substitutes {version}, {env}, and {build} tokens in template. build may be empty when {build} is not present in the template; if {build} is present but build is empty, an error is returned.

func ValidateBuildID added in v0.19.0

func ValidateBuildID(build string) error

ValidateBuildID checks that a build ID is usable as a tag component: non-empty, no "/" (path separator) and no whitespace (git ref constraints). CI build IDs like "$CI_PIPELINE_ID" and "$GITHUB_RUN_NUMBER" satisfy this.

Types

This section is empty.

Jump to

Keyboard shortcuts

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