Help us shape the future of Go! Take the 2026 Go Developer Survey

version

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package version carries the project's version.

The semantic version is the Version const and changes only in source (a release tool such as release-please bumps it). BuildMetadata is the semver "+build" suffix, injected at link time by internal/buildrun via -ldflags "-X". Every component that should report its version must import this package: an -X naming a package the binary does not link is silently discarded.

Index

Constants

View Source
const Version = "0.2.0"

Version is the semantic version, without a leading "v".

Variables

View Source
var BuildMetadata string

BuildMetadata is set at link time (e.g. "pr45.abc1234", "local.abc1234.dirty"). Empty under `go run`.

View Source
var ImportPath = reflect.TypeFor[marker]().PkgPath()

ImportPath is this package's import path — the -X target for BuildMetadata. Derived rather than written as a string literal so it survives a module rename (gonew rewrites imports, not string constants).

Functions

func Full

func Full(metadata string) string

Full returns the version with build metadata when present, e.g. "0.1.0+pr45.abc1234".

func Semver

func Semver() string

Semver returns the version with a leading v, e.g. "v0.1.0" — the tag form.

func String

func String() string

String returns the bare semver, e.g. "0.1.0".

Types

This section is empty.

Jump to

Keyboard shortcuts

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