-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
include build time and revision in version information
- Loading branch information
1 parent
ad812ec
commit ff7fa5a
Showing
3 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
package version | ||
|
||
import "time" | ||
|
||
const defaultBeatVersion = "7.0.0-alpha1" | ||
|
||
var ( | ||
buildTime = "unknown" | ||
commit = "unknown" | ||
) | ||
|
||
// BuildTime exposes the compile-time build time information. | ||
// It will represent the zero time instant if parsing fails. | ||
func BuildTime() time.Time { | ||
t, err := time.Parse(time.RFC3339, buildTime) | ||
if err != nil { | ||
return time.Time{} | ||
} | ||
return t | ||
} | ||
|
||
// Commit exposes the compile-time commit hash. | ||
func Commit() string { | ||
return commit | ||
} |