Documentation ¶
Overview ¶
Package bininfo contains information about the current binary and process. Most of the information available through this interface is filled at build time using the -X linker flag.
This package can be considered an interface between the application (which provides the requisite data at build time and runtime) and various places around our internal libraries (which use this data, e.g. to construct User-Agent headers or log messages).
When using <https://github.com/sapcc/go-makefile-maker>, go-makefile-maker will detect when go-api-declarations is listed as a dependency in the application's go.mod file and generate the appropriate linker flags automatically.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDate ¶
func BuildDate() string
BuildDate returns the buildDate string provided at build time, or "" if none was provided.
func BuildDateOr ¶
BuildDateOr returns the build date string, or the fallback value if none is known. A common invocation is `BuildDateOr("unknown")`.
func Commit ¶
func Commit() string
Commit returns the commit string provided at build time, or "" if none was provided.
func CommitOr ¶
CommitOr returns the commit string provided at build time, or the fallback value if none was provided. A common invocation is `CommitOr("unknown")`.
func Component ¶
func Component() string
Component returns the name of the current binary, followed by the name of the current process's task if one has provided via SetTaskName(). This string can be used to identify the current process, e.g. in User-Agent headers.
For example, the command `tenso worker` calls `SetTaskName("worker")`, so Component() will return "tenso-worker".
func HandleVersionArgument ¶ added in v1.10.9
func HandleVersionArgument()
HandleVersionArgument prints the version string and exits if the first argument to the program is --version
func SetTaskName ¶
func SetTaskName(name string)
SetTaskName identifies the subcommand selected for the current process. This setting influences the output of Component().
Types ¶
This section is empty.