version

package
v0.0.0-...-0fc2cb3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 11 Imported by: ? 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 provides an importable cobra command and a fixed package path location to set compile time version information. To override the default values, set the `-ldflags` flags with the following strings:

sigs.k8s.io/release-utils/version.gitVersion=<GitVersion> sigs.k8s.io/release-utils/version.gitCommit=<GitCommit> sigs.k8s.io/release-utils/version.gitTreeState=<GitTreeState> sigs.k8s.io/release-utils/version.buildDate=<BuildDate>

Example: `go build -ldflags " -X sigs.k8s.io/release-utils/version.gitVersion=v0.4.0-1-g040f53c -X sigs.k8s.io/release-utils/version.gitCommit=040f53c -X sigs.k8s.io/release-utils/version.gitTreeState=dirty -X sigs.k8s.io/release-utils/version.buildDate=2022-02-03T17:30:01Z" .`

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Version

func Version() *cobra.Command

Version returns a cobra command to be added to another cobra command, like: ```go

rootCmd.AddCommand(version.Version())

```

func WithFont

func WithFont(fontName string) *cobra.Command

WithFont returns a cobra command to be added to another cobra command with a select font for ASCII, like: ```go

rootCmd.AddCommand(version.WithFont("starwars"))

```

Types

type Info

type Info struct {
	GitVersion   string `json:"gitVersion"`
	GitCommit    string `json:"gitCommit"`
	GitTreeState string `json:"gitTreeState"`
	BuildDate    string `json:"buildDate"`
	GoVersion    string `json:"goVersion"`
	Compiler     string `json:"compiler"`
	Platform     string `json:"platform"`
	RhtasVersion string `json:"rhtasVersion`

	ASCIIName   string `json:"-"`
	FontName    string `json:"-"`
	Name        string `json:"-"`
	Description string `json:"-"`
}

func GetVersionInfo

func GetVersionInfo() Info

GetVersionInfo represents known information on how this binary was built.

func (*Info) CheckFontName

func (i *Info) CheckFontName(fontName string) bool

func (*Info) JSONString

func (i *Info) JSONString() (string, error)

JSONString returns the JSON representation of the version info

func (*Info) String

func (i *Info) String() string

String returns the string representation of the version info

Jump to

Keyboard shortcuts

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