Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make version getRevision public #563

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions version/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func NewCollector(program string) prometheus.Collector {
),
ConstLabels: prometheus.Labels{
"version": Version,
"revision": getRevision(),
"revision": GetRevision(),
"branch": Branch,
"goversion": GoVersion,
"goos": GoOS,
Expand All @@ -75,7 +75,7 @@ func Print(program string) string {
m := map[string]string{
"program": program,
"version": Version,
"revision": getRevision(),
"revision": GetRevision(),
"branch": Branch,
"buildUser": BuildUser,
"buildDate": BuildDate,
Expand All @@ -94,7 +94,7 @@ func Print(program string) string {

// Info returns version, branch and revision information.
func Info() string {
return fmt.Sprintf("(version=%s, branch=%s, revision=%s)", Version, Branch, getRevision())
return fmt.Sprintf("(version=%s, branch=%s, revision=%s)", Version, Branch, GetRevision())
}

// BuildContext returns goVersion, platform, buildUser and buildDate information.
Expand Down
2 changes: 1 addition & 1 deletion version/info_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package version

func getRevision() string {
func GetRevision() string {
return Revision
}

Expand Down
2 changes: 1 addition & 1 deletion version/info_go118.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import "runtime/debug"
var computedRevision string
var computedTags string

func getRevision() string {
func GetRevision() string {
if Revision != "" {
return Revision
}
Expand Down