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:
parent
56713c8875
commit
957fa78711
2
Makefile
2
Makefile
|
@ -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*
|
||||
|
|
2
main.go
2
main.go
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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."
|
||||
|
|
Reference in a new issue