From fc705289b4317815f9439db5321f7da11bce3cfd Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Tue, 20 Aug 2024 17:54:14 +0800 Subject: [PATCH] util: use runtime.Version() to get Go version (#53619) (#55536) close pingcap/tidb#53618 --- util/printer/printer.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/util/printer/printer.go b/util/printer/printer.go index 084033b603ef2..1355352d3c3c4 100644 --- a/util/printer/printer.go +++ b/util/printer/printer.go @@ -18,8 +18,7 @@ import ( "bytes" "encoding/json" "fmt" - _ "runtime" // import link package - _ "unsafe" // required by go:linkname + "runtime" "github.com/pingcap/tidb/config" "github.com/pingcap/tidb/parser/mysql" @@ -29,6 +28,12 @@ import ( "go.uber.org/zap" ) +var buildVersion string + +func init() { + buildVersion = runtime.Version() +} + // PrintTiDBInfo prints the TiDB version information. func PrintTiDBInfo() { logutil.BgLogger().Info("Welcome to TiDB.", @@ -167,6 +172,3 @@ func GetPrintResult(cols []string, datas [][]string) (string, bool) { value = append(value, getPrintDivLine(maxColLen)...) return string(value), true } - -//go:linkname buildVersion runtime.buildVersion -var buildVersion string