Skip to content

Commit 725ad37

Browse files
myleshortonclaudeCopilot
authored
Fix version reporting: make Version a var for ldflags injection (#359)
* fix: make Version a var so ldflags can inject it at build time Version was a const, which Go ldflags cannot override. This meant all builds reported "9.0.1" regardless of actual release version. Change it to a var and remove the redundant AppVersion var. The lantern Makefile ldflags should target common.Version directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 04e4c56 commit 725ad37

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

backend/headers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func NewRequestWithHeaders(ctx context.Context, method, url string, body io.Read
4343
// based on consistent packet lengths.
4444
req.Header.Add(RandomNoiseHeader, randomizedString())
4545

46-
req.Header.Set(AppVersionHeader, common.AppVersion)
46+
req.Header.Set(AppVersionHeader, common.Version)
4747
req.Header.Set(VersionHeader, common.Version)
4848
req.Header.Set(UserIDHeader, strconv.FormatInt(settings.GetInt64(settings.UserIDKey), 10))
4949
req.Header.Set(PlatformHeader, common.Platform)

common/constants.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ import (
44
"time"
55
)
66

7+
// Version is the application version, injected at build time via ldflags:
8+
//
9+
// -X 'github.com/getlantern/radiance/common.Version=x.y.z'
10+
var Version = "dev"
11+
712
const (
8-
Name = "lantern"
9-
Version = "9.0.1"
13+
Name = "lantern"
1014

1115
// filenames
1216
LogFileName = "lantern.log"
@@ -21,7 +25,6 @@ const (
2125
StageBaseURL = "https://api.staging.iantem.io/v1"
2226
)
2327

24-
var AppVersion = Version
2528

2629
// GetProServerURL returns the pro server URL based on the current environment.
2730
func GetProServerURL() string {

telemetry/otel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func initialize(deviceID string, configResponse common.ConfigResponse, pro bool)
8888
attrs := Attributes{
8989
App: "radiance",
9090
DeviceID: deviceID,
91-
AppVersion: rcommon.AppVersion,
91+
AppVersion: rcommon.Version,
9292
Platform: rcommon.Platform,
9393
GoVersion: runtime.Version(),
9494
OSName: runtime.GOOS,

0 commit comments

Comments
 (0)