Skip to content

Commit

Permalink
util: use runtime.Version() to get Go version (pingcap#53619)
Browse files Browse the repository at this point in the history
  • Loading branch information
dveeden authored and bb7133 committed Nov 12, 2024
1 parent 11c1386 commit d4cb93b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions util/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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.",
Expand Down Expand Up @@ -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

0 comments on commit d4cb93b

Please sign in to comment.