Update version string format in Makefile and code files to use 'v' prefix

This commit is contained in:
alex
2025-07-05 12:56:53 +03:00
parent 2ad4c57b2c
commit b38e492e7e
3 changed files with 5 additions and 5 deletions

View File

@@ -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

View File

@@ -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
}

View File

@@ -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")