From 9cfc7743bc64504e7f5ecc0750aed5e745ae2342 Mon Sep 17 00:00:00 2001 From: Russ Garrett Date: Sun, 15 Jan 2017 10:54:37 +0000 Subject: [PATCH] Add version info --- .travis.yml | 3 ++- main.go | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f839928..80b6eeb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,9 @@ script: - "! gofmt -d . | read" - go test -v ./... before_deploy: +- rm -Rf ./dist - go get github.com/mitchellh/gox -- gox -os="linux darwin" -arch="amd64 386" -output="dist/{{.OS}}_{{.Arch}}_{{.Dir}}" +- gox -ldflags="-X main.branch=$TRAVIS_TAG -X main.revision=$TRAVIS_COMMIT" -os="linux darwin" -arch="amd64 386" -output="dist/{{.OS}}_{{.Arch}}_{{.Dir}}" deploy: provider: releases skip_cleanup: true diff --git a/main.go b/main.go index 857ccde..a48227a 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,9 @@ import ( var log = loggo.GetLogger("main") +var branch string +var revision string + type IRCCat struct { auth_channel string channels mapset.Set @@ -28,7 +31,7 @@ type IRCCat struct { func main() { loggo.ConfigureLoggers("=DEBUG") - log.Infof("IRCCat starting...") + log.Infof("IRCCat %s (%s) starting...", branch, revision) viper.SetConfigName("irccat") viper.AddConfigPath("/etc") viper.AddConfigPath(".")