From b38e492e7ef20581311d7846a5dd88b0fad9ef5f Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 5 Jul 2025 12:56:53 +0300 Subject: [PATCH] Update version string format in Makefile and code files to use 'v' prefix --- Makefile | 2 +- core/config/consts.go | 2 +- core/update/update.go | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 234eb65..bc35297 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ APP_NAME := node BIN_DIR := bin GOPATH := $(shell go env GOPATH) export CONFIG_PATH := ./config.yaml -LDFLAGS := -X 'github.com/akyaiy/GoSally-mvp/core/config.NodeVersion=version0.0.1-dev' +LDFLAGS := -X 'github.com/akyaiy/GoSally-mvp/core/config.NodeVersion=v0.0.1-dev' CGO_CFLAGS := -I/usr/local/include CGO_LDFLAGS := -L/usr/local/lib -llua5.1 -lm -ldl .PHONY: all build run runq test fmt vet lint check clean diff --git a/core/config/consts.go b/core/config/consts.go index f47ec08..601ff95 100644 --- a/core/config/consts.go +++ b/core/config/consts.go @@ -22,7 +22,7 @@ type _updateConsts struct{} func GetUpdateConsts() _updateConsts { return _updateConsts{} } func (_ _updateConsts) GetNodeVersion() string { if NodeVersion == "" { - return "version0.0.0-none" + return "v0.0.0-none" } return NodeVersion } diff --git a/core/update/update.go b/core/update/update.go index aa82d6b..bc792cb 100644 --- a/core/update/update.go +++ b/core/update/update.go @@ -42,10 +42,10 @@ func NewUpdater(log slog.Logger, cfg *config.ConfigConf) *Updater { func splitVersionString(versionStr string) (Version, Branch, error) { versionStr = strings.TrimSpace(versionStr) - if !strings.HasPrefix(versionStr, "version") { - return "", "unknown", errors.New("version string does not start with 'version'") + if !strings.HasPrefix(versionStr, "v") { + return "", "unknown", errors.New("version string does not start with 'v'") } - parts := strings.SplitN(versionStr[len("version"):], "-", 2) + parts := strings.SplitN(versionStr[len("v"):], "-", 2) parts[0] = strings.TrimPrefix(parts[0], "version") if len(parts) != 2 { return Version(parts[0]), Branch("unknown"), errors.New("version string format invalid")