From 407444f0e01d7ad13ab8591e126b7f70c3555b15 Mon Sep 17 00:00:00 2001 From: jharshman Date: Wed, 28 Jan 2026 18:32:14 -0500 Subject: [PATCH] Add ldflags to build to set version. Add a VERSION variable to the Taskfile and ldflags to the go build command to set the main.version variable. This is already done on release, but for dev builds version ends up blank. --- Taskfile.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index b38d4c6..8a31324 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -1,5 +1,8 @@ version: '3' +vars: + VERSION: v0.0.0-devbuild + tasks: has:golangci-lint: @@ -26,5 +29,5 @@ tasks: build: desc: Compile the project cmds: - - go build -o ./bin/ -v ./... + - go build -o ./bin/ -ldflags="-X 'main.version={{.VERSION}}'" -v ./...