123456789101112131415161718192021222324252627282930313233343536 |
- // This file is subject to a 1-clause BSD license.
- // Its contents can be found in the enclosed LICENSE file.
- // Package app defines some utility code which may be shared between packages.
- package app
- import (
- "fmt"
- "runtime"
- )
- // Application name and version constants.
- const (
- Name = "bot"
- VersionMajor = 4
- VersionMinor = 1
- )
- // VersionRevision is the unix timestamp of the last commit.
- // This needs to be a string, as it is defined externally
- // through a command line option.
- var VersionRevision string
- func init() {
- // Make sure the revision has a sane value.
- if len(VersionRevision) == 0 {
- VersionRevision = "0"
- }
- }
- // Version returns the application version as a string.
- func Version() string {
- return fmt.Sprintf("%s %d.%d.%s (Go runtime %s)",
- Name, VersionMajor, VersionMinor, VersionRevision, runtime.Version())
- }
|