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