Skip to content

Commit 31ee931

Browse files
Dumbrisclaude
andauthored
fix(build): use correct module path in ldflags for version injection (#287)
The buildVersion variable in internal/httpapi was not being set during release builds because ldflags used an incorrect module path: - Incorrect: -X mcpproxy-go/internal/httpapi.buildVersion=... - Correct: -X github.com/smart-mcp-proxy/mcpproxy-go/internal/httpapi.buildVersion=... This caused 'mcpproxy doctor' and the web UI to always show "development" instead of the actual version. The CLI --version flag worked correctly because main.version uses the special 'main' package shorthand. Fixed in: - .github/workflows/release.yml - Makefile - scripts/build.sh Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 47cc680 commit 31ee931

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ jobs:
369369
CGO_LDFLAGS: "-mmacosx-version-min=12.0"
370370
run: |
371371
VERSION=${GITHUB_REF#refs/tags/}
372-
LDFLAGS="-s -w -X mcpproxy-go/cmd/mcpproxy.version=${VERSION} -X main.version=${VERSION} -X mcpproxy-go/internal/httpapi.buildVersion=${VERSION}"
372+
LDFLAGS="-s -w -X main.version=${VERSION} -X github.com/smart-mcp-proxy/mcpproxy-go/internal/httpapi.buildVersion=${VERSION}"
373373
374374
# Determine clean binary name
375375
if [ "${{ matrix.goos }}" = "windows" ]; then

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ swagger-verify: swagger
5050
VERSION ?= $(shell git describe --tags --abbrev=0 2>/dev/null || echo "v0.1.0-dev")
5151
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
5252
BUILD_DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
53-
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(BUILD_DATE) -X mcpproxy-go/internal/httpapi.buildVersion=$(VERSION) -s -w
53+
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(BUILD_DATE) -X github.com/smart-mcp-proxy/mcpproxy-go/internal/httpapi.buildVersion=$(VERSION) -s -w
5454

5555
# Build complete project
5656
build: swagger frontend-build

scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ echo "Building mcpproxy version: $VERSION"
1010
echo "Commit: $COMMIT"
1111
echo "Date: $DATE"
1212

13-
LDFLAGS="-X main.version=$VERSION -X main.commit=$COMMIT -X main.date=$DATE -X mcpproxy-go/internal/httpapi.buildVersion=$VERSION -s -w"
13+
LDFLAGS="-X main.version=$VERSION -X main.commit=$COMMIT -X main.date=$DATE -X github.com/smart-mcp-proxy/mcpproxy-go/internal/httpapi.buildVersion=$VERSION -s -w"
1414

1515
# Build for current platform (with CGO for tray support if needed)
1616
echo "Building for current platform..."

0 commit comments

Comments
 (0)