From 0dd93ebfb83587c53c78b2179d05f6ad2e958260 Mon Sep 17 00:00:00 2001 From: Robert Iannucci Date: Thu, 21 Oct 2021 01:05:36 -0700 Subject: [PATCH] Report server version on startup. --- goconvey.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/goconvey.go b/goconvey.go index f569d594..0bcb27ff 100644 --- a/goconvey.go +++ b/goconvey.go @@ -15,6 +15,7 @@ import ( "path/filepath" "regexp" "runtime" + "runtime/debug" "strconv" "strings" "time" @@ -58,7 +59,12 @@ func folders() { func main() { flag.Parse() - log.Printf(initialConfiguration, host, port, nap, cover) + + serverVersion := "" + if binfo, ok := debug.ReadBuildInfo(); ok { + serverVersion = binfo.Main.Version + } + log.Printf(initialConfiguration, host, port, nap, cover, serverVersion) working := getWorkDir() cover = coverageEnabled(cover, reports) @@ -309,7 +315,7 @@ var ( ) const ( - initialConfiguration = "Initial configuration: [host: %s] [port: %d] [poll: %v] [cover: %v]\n" + initialConfiguration = "Initial configuration: [host: %s] [port: %d] [poll: %v] [cover: %v] [server version: %s]\n" pleaseUpgradeGoVersion = "Go version is less that 1.2 (%s), please upgrade to the latest stable version to enable coverage reporting.\n" coverToolMissing = "Go cover tool is not installed or not accessible: for Go < 1.5 run`go get golang.org/x/tools/cmd/cover`\n For >= Go 1.5 run `go install $GOROOT/src/cmd/cover`\n" reportDirectoryUnavailable = "Could not find or create the coverage report directory (at: '%s'). You probably won't see any coverage statistics...\n"