Skip to content
Snippets Groups Projects

Improve logging for gateways returned by menshen

Merged Pea Nut requested to merge fix-854 into main
All threads resolved!
Files
3
package version
import (
"os/exec"
"strings"
"github.com/rs/zerolog/log"
)
var (
// set during build with '-X 0xacab.org/leap/bitmask-vpn/pkg/config/version.appVersion'
appVersion = "unknown"
appVersion = ""
// set when `git archive` is used, the "$Fromat:%(describe)" will be replaced
// by the o/p of `git describe` https://git-scm.com/docs/gitattributes#_export_subst
// set when `git archive` is used, the "$Fromat:%(describe)" will be replaced
// by the o/p of `git describe` https://git-scm.com/docs/gitattributes#_export_subst
gitArchiveVersion = "$Format:%(describe)$"
)
@@ -20,7 +23,15 @@ func Version() string {
case appVersion != "":
return appVersion
default:
// should not reach here
return ""
+2
out, err := exec.Command("git", "describe").Output()
if err != nil {
log.Trace().
Err(err).
Msg("Could not get running version with git")
return "unknown"
} else {
version := string(out)
return strings.TrimSpace(version)
}
}
}
Loading