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.
18 lines
381 B
Go
18 lines
381 B
Go
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)
|
|
}
|