mirror of
https://git.mills.io/saltyim/saltyim.git
synced 2024-06-16 03:48:24 +00:00
668cae61b7
Co-authored-by: James Mills <prologic@shortcircuit.net.au> Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/138 Reviewed-by: xuu <xuu@noreply@mills.io>
30 lines
547 B
Go
30 lines
547 B
Go
package saltyim
|
|
|
|
import (
|
|
"fmt"
|
|
"runtime/debug"
|
|
)
|
|
|
|
var (
|
|
// Version release version
|
|
Version = "0.0.0"
|
|
|
|
// Commit will be overwritten automatically by the build system
|
|
Commit = "HEAD"
|
|
)
|
|
|
|
// FullVersion display the full version and build
|
|
func FullVersion() string {
|
|
if Version != "0.0.0" && Commit != "HEAD" {
|
|
return fmt.Sprintf("%s@%s", Version, Commit)
|
|
}
|
|
info, ok := debug.ReadBuildInfo()
|
|
if !ok {
|
|
return "unknown"
|
|
}
|
|
return fmt.Sprintf(
|
|
"%s built with %s (checksum: %s)",
|
|
info.Main.Version, info.GoVersion, info.Main.Sum,
|
|
)
|
|
}
|