Specify program version at build time

The version string is obtained by running `git describe` rather than
being hardcoded in `strings.go`.
This commit is contained in:
Sam Morris 2016-02-24 01:40:17 +00:00
parent 56713c8875
commit 957fa78711
3 changed files with 4 additions and 4 deletions

View file

@ -4,7 +4,7 @@ mumbledj: main.go commands.go parseconfig.go strings.go service.go youtube_dl.go
go get github.com/karmakaze/goop
rm -rf Goopfile.lock
goop install
goop go build -o mumbledj
goop go build -o mumbledj -ldflags '-X strings.VERSION $(shell git describe --tags --dirty)'
clean:
rm -f mumbledj*

View file

@ -214,7 +214,7 @@ func main() {
flag.Parse()
if version {
fmt.Printf("MumbleDJ %s\n", VERSION)
fmt.Printf("MumbleDJ v%s\n", VERSION)
os.Exit(0)
}

View file

@ -8,10 +8,10 @@
package main
// Current version of the bot
const VERSION = "v2.8.15"
var VERSION = "Unknown"
// Message shown to users when they request the version of the bot
const DJ_VERSION = "MumbleDJ <b>" + VERSION + "</b>"
var DJ_VERSION = "MumbleDJ <b>v" + VERSION + "</b>"
// Message shown to users when the bot has an invalid API key.
const INVALID_API_KEY = "MumbleDJ does not have a valid %s API key."