Add version and build number output

This commit is contained in:
Jan Dittberner 2017-04-18 16:07:54 +02:00
parent 471daf12ea
commit bcfbad42b6
3 changed files with 16 additions and 1 deletions

2
.gitignore vendored
View file

@ -3,6 +3,6 @@
*.pem
.*.swp
.idea/
cacert-board_vote
cacert-boardvoting
config.yaml
database.sqlite

11
Makefile Normal file
View file

@ -0,0 +1,11 @@
VERSION := $(shell git describe --always --dirty=-dev)
BUILD := $(shell date --iso-8601=seconds --utc)
GOFILES := $(wildcard *.go)
cacert-boardvoting: ${GOFILES}
go build -o $@ -ldflags "-X 'main.version=${VERSION}' -X 'main.build=${BUILD}'"
clean:
rm -f cacert-boardvoting
.PHONY: clean

View file

@ -23,6 +23,8 @@ import (
var logger *log.Logger
var config *Config
var store *sessions.CookieStore
var version = "undefined"
var build = "undefined"
const sessionCookieName = "votesession"
@ -407,6 +409,8 @@ func init() {
}
func main() {
logger.Printf("CAcert Board Voting version %s, build %s\n", version, build)
var err error
db, err = sqlx.Open("sqlite3", config.DatabaseFile)
if err != nil {