From f5c54a00b0f3026221fe0b39ca2f683383042233 Mon Sep 17 00:00:00 2001 From: Stuart Carnie Date: Wed, 13 Mar 2019 16:06:26 -0700 Subject: [PATCH] feat(influxdb): Add global BuildInfo Permits binary packages to set a global BuildInfo state that can be inspected by other packages --- build.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/build.go b/build.go index b5725e746b..606e94960b 100644 --- a/build.go +++ b/build.go @@ -6,3 +6,17 @@ type BuildInfo struct { Commit string // Commit is the current git commit SHA Date string // Date is the build date in RFC3339 } + +var buildInfo BuildInfo + +// SetBuildInfo sets the build information for the binary. +func SetBuildInfo(version, commit, date string) { + buildInfo.Version = version + buildInfo.Commit = commit + buildInfo.Date = date +} + +// GetBuildInfo returns the current build information for the binary. +func GetBuildInfo() BuildInfo { + return buildInfo +}