version

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package version provides a built-in versioning based on the version of your go modules.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildInfo

type BuildInfo struct {
	GoVersion  string               `json:"goVersion"`
	Version    string               `json:"version"`
	Commit     string               `json:"commit"`
	Date       string               `json:"date"`
	IsModified bool                 `json:"isModified"`
	Settings   []debug.BuildSetting `json:"-"`
}

BuildInfo holds versioning information

func Resolve

func Resolve() BuildInfo

Resolve build information.

There are 2 possible sources to resolve version information.

1. It may be populated by your build system at release build time e.g. go build -ldflags="-X 'github.com/fredbi/go-cli/cli/version.buildVersion=v1.0.0'"

For more information, see this excellent tutorial: https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications

2. It may be populated by the go runtime, collecting metadata from the build.

Jump to

Keyboard shortcuts

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