Skip to content

Commit 3b18f84

Browse files
authored
Fix --version flag getting the correct value during build (#32)
1 parent 0670376 commit 3b18f84

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev
1515

1616
# Linker flags for injecting version
1717
# The path is MODULE_PATH/package.variableName
18-
LDFLAGS := -X '$(MODULE_PATH)/cmd.version=$(VERSION)'
18+
LDFLAGS := -X '$(MODULE_PATH)/internal/cmd.version=$(VERSION)'
1919

2020
test:
2121
go test ./...

internal/cmd/basecmd.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
"github.com/mozilla-ai/mcpd/v2/internal/runtime"
1515
)
1616

17+
// version should not be moved/modified without consulting the Makefile,
18+
// as the path to this var is set on the LDFLAGS variable in the script.
1719
var version = "dev" // Set at build time using -ldflags
1820

1921
// Version is used by other packages to retrieve the build version of mcpd.

0 commit comments

Comments
 (0)