chore: support adding version at build time

This commit is contained in:
Valentin Doreau 2024-11-01 19:34:36 +01:00
parent 35bce36222
commit bd8537a334
Signed by: vdoreau
GPG key ID: F3E456CF9A14098B
2 changed files with 5 additions and 4 deletions

View file

@ -1,13 +1,13 @@
.PHONY: all build clean
PROJECT_NAME = $(shell head -n1 go.mod | cut -d'/' -f2)
PROJECT_NAME = $(shell head -n1 go.mod | cut -d'/' -f2)
VERSION ?= dev
all: build
# Build static executable
build:
CGO_ENABLED=0 go build
CGO_ENABLED=0 go build -ldflags "-X main.VERSION=${VERSION}"
strip $(PROJECT_NAME)
clean:

View file

@ -13,7 +13,8 @@ import (
"recycled.cloud/app-exporter/apps"
)
const VERSION = "0.1.0"
// var so it can be overridden at build time
var VERSION = "dev"
const LISTEN_ADDR = ":9404"
const INTERVAL = 24 * time.Hour