chore: support adding version at build time
This commit is contained in:
parent
35bce36222
commit
bd8537a334
2 changed files with 5 additions and 4 deletions
6
Makefile
6
Makefile
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue