forked from elastic/elastic-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelper.go
37 lines (31 loc) · 951 Bytes
/
helper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.
package version
import "time"
// GetDefaultVersion returns the current libbeat version.
// This method is in a separate file as the version.go file is auto generated
func GetDefaultVersion() string {
if qualifier == "" {
return defaultBeatVersion
}
return defaultBeatVersion + "-" + qualifier
}
var (
buildTime = "unknown"
commit = "unknown"
qualifier = ""
)
// 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
}