version.go 852 B

123456789101112131415161718192021222324252627282930313233343536
  1. // This file is subject to a 1-clause BSD license.
  2. // Its contents can be found in the enclosed LICENSE file.
  3. // Package app defines some utility code which may be shared between packages.
  4. package app
  5. import (
  6. "fmt"
  7. "runtime"
  8. )
  9. // Application name and version constants.
  10. const (
  11. Name = "bot"
  12. VersionMajor = 4
  13. VersionMinor = 1
  14. )
  15. // VersionRevision is the unix timestamp of the last commit.
  16. // This needs to be a string, as it is defined externally
  17. // through a command line option.
  18. var VersionRevision string
  19. func init() {
  20. // Make sure the revision has a sane value.
  21. if len(VersionRevision) == 0 {
  22. VersionRevision = "0"
  23. }
  24. }
  25. // Version returns the application version as a string.
  26. func Version() string {
  27. return fmt.Sprintf("%s %d.%d.%s (Go runtime %s)",
  28. Name, VersionMajor, VersionMinor, VersionRevision, runtime.Version())
  29. }