Add version package and update the makefile
The makefile will grab the version info from git and pass it to the linker so that version information based on tags, commits and commit times is available in the code.
This commit is contained in:
1 parent
6998a0fa0a
commit
9f28796e8a
3 files changed
+32
-6
No files matched your search
@@ -0,0 +1,17 @@
|
||||
package version
|
||||
|
||||
import "fmt"
|
||||
|
||||
var (
|
||||
Version = "dev"
|
||||
GitCommit = "unknown"
|
||||
CommitDateTime = "unknown"
|
||||
SchemaVersion = 1
|
||||
)
|
||||
|
||||
// PrintVersionInfo prints formatted version information to stdout
|
||||
func Print() {
|
||||
fmt.Printf("Version: %s\n", Version)
|
||||
fmt.Printf("Git commit: %s %s\n", GitCommit, CommitDateTime)
|
||||
fmt.Printf("Schema: v%d\n", SchemaVersion)
|
||||
}
|
||||
Reference in new issue
Block a user