Skip to content

Commit 2d53bd9

Browse files
committed
fix release
1 parent 52a7e7e commit 2d53bd9

File tree

4 files changed

+19
-20
lines changed

4 files changed

+19
-20
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ============= Build Stage ================
2-
FROM golang:1.22.10-bookworm AS builder
2+
FROM golang:1.23.7-bookworm AS builder
33

44
WORKDIR /build
55
# Copy and download avalanche dependencies using go mod

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func createApp(cmd *cobra.Command, _ []string) error {
146146
if err := checkForUpdates(cmd, app); err != nil {
147147
return err
148148
}
149-
if err := version.CheckCLIVersionIsOverMin(app, metrics.GetCLIVersion()); err != nil {
149+
if err := version.CheckCLIVersionIsOverMin(app, app.GetVersion()); err != nil {
150150
return err
151151
}
152152
return nil

pkg/application/app.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,3 +989,19 @@ func (app *Avalanche) GetNetworkFromSidecarNetworkName(
989989
}
990990
return models.UndefinedNetwork, fmt.Errorf("unsupported network name")
991991
}
992+
993+
func (app *Avalanche) GetVersion() string {
994+
if app.Version != "" {
995+
return app.Version
996+
}
997+
wdPath, err := os.Getwd()
998+
if err != nil {
999+
return ""
1000+
}
1001+
versionPath := filepath.Join(wdPath, "VERSION")
1002+
content, err := os.ReadFile(versionPath)
1003+
if err != nil {
1004+
return ""
1005+
}
1006+
return string(content)
1007+
}

pkg/metrics/metrics.go

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package metrics
55
import (
66
"fmt"
77
"os"
8-
"path/filepath"
98
"runtime"
109
"strings"
1110

@@ -25,19 +24,6 @@ var (
2524
sent = false
2625
)
2726

28-
func GetCLIVersion() string {
29-
wdPath, err := os.Getwd()
30-
if err != nil {
31-
return ""
32-
}
33-
versionPath := filepath.Join(wdPath, "VERSION")
34-
content, err := os.ReadFile(versionPath)
35-
if err != nil {
36-
return ""
37-
}
38-
return string(content)
39-
}
40-
4127
func getMetricsUserID(app *application.Avalanche) string {
4228
if !app.Conf.ConfigFileExists() || !app.Conf.ConfigValueIsSet(constants.ConfigMetricsUserIDKey) {
4329
userID := utils.RandomString(20)
@@ -108,10 +94,7 @@ func trackMetrics(app *application.Avalanche, flags map[string]string, cmdErr er
10894
app.Log.Warn(fmt.Sprintf("failure creating metrics client: %s", err))
10995
}
11096

111-
version := app.Version
112-
if version == "" {
113-
version = GetCLIVersion()
114-
}
97+
version := app.GetVersion()
11598

11699
userID := getMetricsUserID(app)
117100

0 commit comments

Comments
 (0)