From 24b8cdd96bf7f120445829bb6f3b65270aa060c8 Mon Sep 17 00:00:00 2001 From: Jason Lyu Date: Sun, 21 Jul 2024 20:34:24 -0400 Subject: [PATCH] Refactor(debug): simplify version string (#380) --- internal/version/debug.go | 7 ------- internal/version/version.go | 15 +-------------- restapi/server.go | 1 - 3 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 internal/version/debug.go diff --git a/internal/version/debug.go b/internal/version/debug.go deleted file mode 100644 index a2c3afab..00000000 --- a/internal/version/debug.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build debug - -package version - -func init() { - _debug = true -} diff --git a/internal/version/version.go b/internal/version/version.go index 3bb92ae6..d5951f20 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -9,8 +9,6 @@ import ( const Name = "tun2socks" var ( - _debug = false - // Version can be set at link time by executing // the command: `git describe --abbrev=0 --tags HEAD` Version string @@ -20,19 +18,8 @@ var ( GitCommit string ) -func versionize(s string) string { - return strings.TrimPrefix(s, "v") -} - -func Debug() bool { - return _debug -} - func String() string { - if !Debug() { - return fmt.Sprintf("%s-%s", Name, versionize(Version)) - } - return fmt.Sprintf("%s-%s (debug)", Name, versionize(Version)) + return fmt.Sprintf("%s-%s", Name, strings.TrimPrefix(Version, "v")) } func BuildString() string { diff --git a/restapi/server.go b/restapi/server.go index 3db92e4c..b55462a4 100644 --- a/restapi/server.go +++ b/restapi/server.go @@ -210,7 +210,6 @@ func version(w http.ResponseWriter, r *http.Request) { render.JSON(w, r, render.M{ "version": V.Version, "commit": V.GitCommit, - "debug": V.Debug(), "modules": V.Info(), }) }