buildinfo

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRunNameForProgram

func GetRunNameForProgram() string

GetRunNameForProgram returns the base name of the running program

Types

type Info

type Info struct {
	// BuiltBy who/what build this version
	BuiltBy string
	// Date compiled
	Date string
	// Commit used for build
	Commit string
	// CompiledName compile name used for build
	CompiledName string
	// RunName is the name of the program obtained from arg[0]
	RunName string
	// Version is the version of the program
	Version string
	// Start dir is the working directory when the program starts
	StartDir string
}

Info is information about the build

func GetBuildInfo

func GetBuildInfo(ctx context.Context) Info

GetRunContext returns the run context

func NewInfo

func NewInfo(version, commit, date, builtBy, compiledName string) Info

NewInfo creates a new info from the passed arguments Use NewInfo to pass in the information captured from link flags.

Eg --ldflags "-s -w -X main.version={{ .Version }} -X main.commit={{ .Commit }} -X main.date={{ .CommitDate }} -X main.builtBy={{ .Env.BUILTBY }}"

func (Info) NewContext

func (info Info) NewContext(ctx context.Context) context.Context

NewContext creates a new context containing the build information

func (Info) String

func (info Info) String() string

String converts the build info to a string

Jump to

Keyboard shortcuts

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