version

package
v2.0.330 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 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

Overview

Package version exposes the build version of the binaries. The version is set by the linker (-X ...internal/version.build=<version>, as make build does with GIT_VERSION) and otherwise read from the module build information, so a plain go build or go install reports its module version or VCS revision. PopulateFromBuild parses "[v]major.minor.commit[-dirty]".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	Major   uint   `json:"major"`
	Minor   uint   `json:"minor"`
	Commit  uint   `json:"commi"`
	Build   string `json:"build"`
	Runtime string `json:"runtime"`
	// contains filtered or unexported fields
}

Info describes a version of an executable

func Current

func Current() Info

Current returns the current version [set by the build]

func (Info) Float

func (v Info) Float() float32

Float returns the version Major/Minor as a float Major.Minor e.g. given Major:3 Minor:52001, it'll return 3.52001 this is only valid if PopulateFromBuild has been called.

func (Info) GreaterOrEqual

func (v Info) GreaterOrEqual(than Info) bool

GreaterOrEqual returns true if the version 'v' is the same or new that the supplied parameter 'other' This only examines the Major & Minor field (as the SHA in Build provides no ordering indication)

func (*Info) PopulateFromBuild

func (v *Info) PopulateFromBuild()

PopulateFromBuild parses the major, minor and commit values from Build, which is expected in the format [v]major.minor.commit[-dirty]; make build links it in from GIT_VERSION (see current.go). Values that do not match stay zero.

func (Info) String

func (v Info) String() string

Jump to

Keyboard shortcuts

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