[GH-ISSUE #263] Version string missing in binary since v0.5.1+ (ldflags regression) #160

Closed
opened 2026-02-28 14:25:54 +03:00 by kerem · 0 comments
Owner

Originally created by @leodurandfr on GitHub (Nov 30, 2025).
Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/263

Description

Starting from version 0.5.1 (or later), the released binaries no longer contain the semantic version string. Instead, only the git commit hash is embedded.

Expected behavior

$ go-librespot
level=info msg="running go-librespot 0.5.3"

Actual behavior

$ go-librespot
level=info msg="running go-librespot ab178ffd"

Root cause

The Dockerfile.build ldflags changed between versions:

v0.5.0 (working):
-ldflags="-X github.com/devgianlu/go-librespot.commit=${COMMIT} -X github.com/devgianlu/go-librespot.version=${VERSION}"

v0.5.3 (current):
-ldflags "-s -w"

The -X flags that inject the version and commit variables are no longer present.

Impact

  • Users cannot easily determine which version is installed
  • The VersionNumberString() function in version.go falls back to commit hash instead of semantic version

Suggested fix

Restore the ldflags in Dockerfile.build:
-ldflags="-s -w -X github.com/devgianlu/go-librespot.commit=${COMMIT} -X github.com/devgianlu/go-librespot.version=${VERSION}"

Originally created by @leodurandfr on GitHub (Nov 30, 2025). Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/263 **Description** Starting from version 0.5.1 (or later), the released binaries no longer contain the semantic version string. Instead, only the git commit hash is embedded. **Expected behavior** $ go-librespot level=info msg="running go-librespot 0.5.3" **Actual behavior** $ go-librespot level=info msg="running go-librespot ab178ffd" **Root cause** The Dockerfile.build ldflags changed between versions: **v0.5.0 (working):** -ldflags="-X github.com/devgianlu/go-librespot.commit=${COMMIT} -X github.com/devgianlu/go-librespot.version=${VERSION}" **v0.5.3 (current):** -ldflags "-s -w" The -X flags that inject the version and commit variables are no longer present. **Impact** - Users cannot easily determine which version is installed - The VersionNumberString() function in version.go falls back to commit hash instead of semantic version **Suggested fix** Restore the ldflags in Dockerfile.build: -ldflags="-s -w -X github.com/devgianlu/go-librespot.commit=${COMMIT} -X github.com/devgianlu/go-librespot.version=${VERSION}"
kerem 2026-02-28 14:25:54 +03:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-librespot#160
No description provided.