From 7aa3aae4e6591629ef60221bf4d2559926ddb4bd Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Tue, 5 Nov 2024 23:29:24 +0100 Subject: [PATCH] fix: drop "v" from version string const - remove "v" prefix from GoTomatoVersion constant - re-add "v" for for human readable output (`-version`) - update README --- README.md | 10 +++++----- cmd/server/main.go | 4 ++-- internal/metadata/version.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 15e4f08..c2d9e51 100644 --- a/README.md +++ b/README.md @@ -67,11 +67,11 @@ The server periodically (every second) sends JSON-encoded messages to all connec | Message Type | Example | | --- | --- | -| Welcome Message | {"mode":"Idle", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":0, "time_left":1500, "ongoing":false, "paused":false, "version":"v0"} | -| Session Running | {"mode":"Work", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":1, "time_left":900, "ongoing":true, "paused":false, "version":"v0"} | -| Session Running | {"mode":"ShortBreak", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":2, "time_left":50, "ongoing":true, "paused":false, "version":"v0"} | -| Session Paused | {"mode":"Work", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":2, "time_left":456, "ongoing":true, "paused":true, "version":"v0"} | -| Session End/Reset | {"mode":"End", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":0, "time_left":0, "ongoing":false, "paused":false, "version":"v0"} | +| Welcome Message | {"mode":"Idle", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":0, "time_left":1500, "ongoing":false, "paused":false, "version":"0"} | +| Session Running | {"mode":"Work", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":1, "time_left":900, "ongoing":true, "paused":false, "version":"0"} | +| Session Running | {"mode":"ShortBreak", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":2, "time_left":50, "ongoing":true, "paused":false, "version":"0"} | +| Session Paused | {"mode":"Work", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":2, "time_left":456, "ongoing":true, "paused":true, "version":"0"} | +| Session End/Reset | {"mode":"End", "settings":{"work":1500, "shortBreak":300, "longBreak":900, "sessions":4}, "session":0, "time_left":0, "ongoing":false, "paused":false, "version":"0"} | ## Testing diff --git a/cmd/server/main.go b/cmd/server/main.go index a109f38..29241f0 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -28,8 +28,8 @@ func Start() { // show server and protocl version and exit if *showVersionFlag { - fmt.Println("Server-Version:", metadata.GoTomatoVersion) - fmt.Println("Protocol-Version:", metadata.ProtocolVersion) + fmt.Printf("Server-Version: v%s\n", metadata.GoTomatoVersion) + fmt.Printf("Protocol-Version: v%s\n", metadata.ProtocolVersion) os.Exit(0) } diff --git a/internal/metadata/version.go b/internal/metadata/version.go index 8968337..f05a892 100644 --- a/internal/metadata/version.go +++ b/internal/metadata/version.go @@ -2,5 +2,5 @@ package metadata import "strings" -const GoTomatoVersion = "v0.0.8" // The GoTomato version +const GoTomatoVersion = "0.0.8" // The GoTomato version var ProtocolVersion = strings.Split(GoTomatoVersion, ".")[0] // The protocol version