Browse Source

Print commit hash

master
Bohdan Horbeshko 1 week ago
parent
commit
d66f87485d
2 changed files with 11 additions and 2 deletions
  1. +3
    -1
      Makefile
  2. +8
    -1
      telegabber.go

+ 3
- 1
Makefile View File

@ -1,7 +1,9 @@
.PHONY: all test
COMMIT := $(shell git rev-parse --short HEAD)
all:
go build -o telegabber
go build -ldflags "-X main.commit=${COMMIT}" -o telegabber
test:
go test -v ./config ./ ./telegram ./xmpp ./xmpp/gateway ./persistence ./telegram/formatter


+ 8
- 1
telegabber.go View File

@ -15,7 +15,8 @@ import (
goxmpp "gosrc.io/xmpp"
)
const version string = "1.3.0"
var version string = "1.4.0-dev"
var commit string
var sm *goxmpp.StreamManager
var component *goxmpp.Component
@ -25,6 +26,10 @@ var cleanupDone chan struct{}
var sigintChannel chan os.Signal
func main() {
if commit != "" {
version = fmt.Sprintf("%v-%v", version, commit)
}
var profilingPort = flag.Int("profiling-port", 0, "The port for pprof server")
// YAML config, compatible with the format of Zhabogram 2.0.0
var configPath = flag.String("config", "config.yml", "Config file path")
@ -55,6 +60,8 @@ func main() {
SetLogrusLevel(config.XMPP.Loglevel)
log.Infof("Starting telegabber version %v", version)
sm, component, err = xmpp.NewComponent(config.XMPP, config.Telegram)
if err != nil {
log.Fatal(err)


Loading…
Cancel
Save