ver

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: GPL-3.0 Imports: 6 Imported by: 19

README

Versioneer

Product and dependency version helper.

Description

This package does several useful things.

  1. It prints some nice looking text about the following things:
  • Name of the program
  • Version of the program
  • List of dependencies containing:
    • Dependency names
    • Dependency versions
  1. It checks for updates on GitHub:
  • If an updated version of the program is available, this library tell about it.
Attention

Due to an old bug #29228 issued on 13.12.2018 ( https://github.com/golang/go/issues/29228 ) which resulted in a chain of other opened issues, such as #50603 ( https://github.com/golang/go/issues/50603 ), we can see that current version of Go language incorrectly shows version text of the main package manually built from the repository's source code. It means that versioning mechanism in Go is still not working as it should :/

Mister Bean

Well ... this is Go, my friends. This is not the C#.

The good news is that one of the comments in the issue #50603 states that:

The version is recorded as expected when doing go install

This means that if you see a (devel) version instead of a normal version taken from the Git tag, you should use go install instead of go build to build your projects.

Documentation

Index

Constants

View Source
const (
	IntroTextShort       = "%s, ver. %s. Go language: %s."
	IntroTextFull        = "%s %s, ver. %s. Go language: %s."
	MsgUpdateIsAvailable = "An update is available to version %v."
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Versioneer

type Versioneer struct {
	// contains filtered or unexported fields
}

Versioneer is an extended version of the ProgramInfo class.

func New

func New() (v *Versioneer, err error)

func (*Versioneer) DependenciesList

func (v *Versioneer) DependenciesList() (list []*pi.Dependency)

func (*Versioneer) DependenciesText

func (v *Versioneer) DependenciesText() (txt string)

func (*Versioneer) IsUpdateAvailable

func (v *Versioneer) IsUpdateAvailable() bool

func (*Versioneer) LatestVersion

func (v *Versioneer) LatestVersion() *ver.Version

func (*Versioneer) ProgramName

func (v *Versioneer) ProgramName() (programName string)

func (*Versioneer) ProgramVcsVersion

func (v *Versioneer) ProgramVcsVersion() *ver.Version

func (*Versioneer) ProgramVersionString

func (v *Versioneer) ProgramVersionString() (programVersion string)

func (*Versioneer) ShowComponentsInfoList

func (v *Versioneer) ShowComponentsInfoList()

func (*Versioneer) ShowComponentsInfoText

func (v *Versioneer) ShowComponentsInfoText()

func (*Versioneer) ShowIntroText

func (v *Versioneer) ShowIntroText(product string)

ShowIntroText shows introductory text about the program. The 'product' parameter is optional. If it is set, it is printed after the program name. It is used mostly for showing server and client variants of a product.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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