[DEPRECATED] Go implementation of plcbundle
1package main
2
3import "runtime/debug"
4
5var (
6 version = "dev"
7 gitCommit = "unknown"
8 buildDate = "unknown"
9)
10
11func init() {
12 if info, ok := debug.ReadBuildInfo(); ok {
13 if info.Main.Version != "" && info.Main.Version != "(devel)" {
14 version = info.Main.Version
15 }
16
17 for _, setting := range info.Settings {
18 switch setting.Key {
19 case "vcs.revision":
20 if setting.Value != "" {
21 gitCommit = setting.Value
22 if len(gitCommit) > 7 {
23 gitCommit = gitCommit[:7]
24 }
25 }
26 case "vcs.time":
27 if setting.Value != "" {
28 buildDate = setting.Value
29 }
30 }
31 }
32 }
33}
34
35// GetVersion returns the version string
36func GetVersion() string {
37 return version
38}
39
40func getGitCommit() string {
41 return gitCommit
42}
43
44func getBuildDate() string {
45 return buildDate
46}