mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-03 17:52:24 +00:00
Update version string format in Makefile and code files to use 'v' prefix
This commit is contained in:
2
Makefile
2
Makefile
@@ -2,7 +2,7 @@ APP_NAME := node
|
|||||||
BIN_DIR := bin
|
BIN_DIR := bin
|
||||||
GOPATH := $(shell go env GOPATH)
|
GOPATH := $(shell go env GOPATH)
|
||||||
export CONFIG_PATH := ./config.yaml
|
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_CFLAGS := -I/usr/local/include
|
||||||
CGO_LDFLAGS := -L/usr/local/lib -llua5.1 -lm -ldl
|
CGO_LDFLAGS := -L/usr/local/lib -llua5.1 -lm -ldl
|
||||||
.PHONY: all build run runq test fmt vet lint check clean
|
.PHONY: all build run runq test fmt vet lint check clean
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type _updateConsts struct{}
|
|||||||
func GetUpdateConsts() _updateConsts { return _updateConsts{} }
|
func GetUpdateConsts() _updateConsts { return _updateConsts{} }
|
||||||
func (_ _updateConsts) GetNodeVersion() string {
|
func (_ _updateConsts) GetNodeVersion() string {
|
||||||
if NodeVersion == "" {
|
if NodeVersion == "" {
|
||||||
return "version0.0.0-none"
|
return "v0.0.0-none"
|
||||||
}
|
}
|
||||||
return NodeVersion
|
return NodeVersion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ func NewUpdater(log slog.Logger, cfg *config.ConfigConf) *Updater {
|
|||||||
|
|
||||||
func splitVersionString(versionStr string) (Version, Branch, error) {
|
func splitVersionString(versionStr string) (Version, Branch, error) {
|
||||||
versionStr = strings.TrimSpace(versionStr)
|
versionStr = strings.TrimSpace(versionStr)
|
||||||
if !strings.HasPrefix(versionStr, "version") {
|
if !strings.HasPrefix(versionStr, "v") {
|
||||||
return "", "unknown", errors.New("version string does not start with 'version'")
|
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")
|
parts[0] = strings.TrimPrefix(parts[0], "version")
|
||||||
if len(parts) != 2 {
|
if len(parts) != 2 {
|
||||||
return Version(parts[0]), Branch("unknown"), errors.New("version string format invalid")
|
return Version(parts[0]), Branch("unknown"), errors.New("version string format invalid")
|
||||||
|
|||||||
Reference in New Issue
Block a user