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,
|
|
)
|
|
}
|