version

package
v0.0.86 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Show

func Show()

Show prints the build information in JSON format. This function uses the sync.Once mechanism to ensure that the build information is initialized only once, thus avoiding the problem of concurrent initialization and ensuring thread safety.

Types

type BuildInfo

type BuildInfo struct {
	GitTag       string `json:"git_tag,omitempty"`
	GitCommit    string `json:"git_commit,omitempty"`
	GitBranch    string `json:"git_branch,omitempty"`
	GitTreeState string `json:"git_tree_state,omitempty"`
	BuildDate    string `json:"build_date,omitempty"`
	BuiltBy      string `json:"built_by,omitempty"`
	GoVersion    string `json:"go_version,omitempty"`
	Compiler     string `json:"compiler,omitempty"`
	Platform     string `json:"platform,omitempty"`
	Version      string `json:"version,omitempty"`
}

func Get

func Get() BuildInfo

Get returns an instance of BuildInfo. This function ensures that the build information is initialized only once using sync.Once, which improves performance and ensures thread safety.

Returns:

  • BuildInfo: A struct containing detailed build information.

Jump to

Keyboard shortcuts

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