diff --git a/integrations/inputunifi/Makefile b/integrations/inputunifi/Makefile index 452012e6..05d22d7c 100644 --- a/integrations/inputunifi/Makefile +++ b/integrations/inputunifi/Makefile @@ -1,20 +1,22 @@ PACKAGES=`find ./cmd -mindepth 1 -maxdepth 1 -type d` BINARY=unifi-poller +VERSION=`git tag -l --merged | tail -n1` all: clean man build clean: for p in $(PACKAGES); do rm -f `echo $${p}|cut -d/ -f3`{,.1,.1.gz}; done rm -rf package_build unifi-poller_*.deb unifi-poller-*.rpm unifi-poller-*.pkg + rm -f unifi-poller.*.gz build: - for p in $(PACKAGES); do go build -ldflags "-w -s" $${p}; done + for p in $(PACKAGES); do go build -ldflags "-w -s -X main.Version=$(VERSION)" $${p}; done linux: - for p in $(PACKAGES); do GOOS=linux go build -ldflags "-w -s" $${p}; done + for p in $(PACKAGES); do GOOS=linux go build -ldflags "-w -s -X main.Version=$(VERSION)" $${p}; done darwin: - for p in $(PACKAGES); do GOOS=darwin go build -ldflags "-w -s" $${p}; done + for p in $(PACKAGES); do GOOS=darwin go build -ldflags "-w -s -X main.Version=$(VERSION)" $${p}; done test: lint for p in $(PACKAGES) $(LIBRARYS); do go test -race -covermode=atomic $${p}; done diff --git a/integrations/inputunifi/cmd/unifi-poller/config.go b/integrations/inputunifi/cmd/unifi-poller/config.go index eea65377..44b84be1 100644 --- a/integrations/inputunifi/cmd/unifi-poller/config.go +++ b/integrations/inputunifi/cmd/unifi-poller/config.go @@ -2,8 +2,8 @@ package main import "time" -// Version is loosely followed. -var Version = "v1.1.1" +// Version is injected by the Makefile +var Version = "development" const ( // App defaults in case they're missing from the config.