"time"
)
+// Following variables should normally be updated via `-ldflags "-X ..."`.
+// However, the version string is hard-coded to ensure it is always included
+// even with bare go build/install.
var (
- name = "govpp"
- version = "v0.0.0+unknown"
- commitHash = "unknown"
- buildBranch = "HEAD"
- buildStamp = ""
- buildUser = ""
- buildHost = ""
+ name = "govpp"
+ version = "v0.4.0-dev"
+ commit = "unknown"
+ branch = "HEAD"
+ buildStamp = ""
+ buildUser = ""
+ buildHost = ""
buildDate time.Time
)
buildDate = time.Unix(buildstampInt64, 0)
}
+func Version() string {
+ return version
+}
+
func Info() string {
return fmt.Sprintf(`%s %s`, name, version)
}
Build date: %s
Go runtime: %s (%s/%s)`,
name,
- version, buildBranch, commitHash,
+ version, branch, commit,
buildUser, buildHost, buildDate.Format(time.UnixDate),
runtime.Version(), runtime.GOOS, runtime.GOARCH,
)