version

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package version normalizes version strings to PEP 440.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Normalize

func Normalize(v string) (string, error)

Normalize converts a version string in either semver or PEP 440 format to a PEP 440-compatible string. A leading "v" prefix is stripped first.

Accepted forms:

  • Semver pre-release: v1.2.3-alpha.1 → 1.2.3a1
  • Semver pre-release: v1.2.3-beta → 1.2.3b0
  • PEP 440 direct: v1.2.3 → 1.2.3
  • PEP 440 pre-release: 1.2.3a1, 1.2.3.dev0, etc.

func Resolve

func Resolve(ctx context.Context, explicit string) (string, error)

Resolve returns a normalized PEP 440 version from an explicit string or, when explicit is empty, from CI environment variables or the current git tag via `git describe --tags --exact-match`.

Environment variables checked (in order):

  • GORELEASER_CURRENT_TAG
  • GITHUB_REF_NAME

These are checked before running git because shallow clones (common in GitHub Actions) may cause git describe to fail.

Types

This section is empty.

Jump to

Keyboard shortcuts

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