Skip to content

Commit

Permalink
util: use runtime.Version() to get Go version (#53619) (#55535)
Browse files Browse the repository at this point in the history
close #53618
  • Loading branch information
ti-chi-bot authored Aug 20, 2024
1 parent f5f7f3e commit 07eae70
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/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/pkg/config"
"github.com/pingcap/tidb/pkg/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() {
fields := []zap.Field{
Expand Down Expand Up @@ -175,6 +180,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 07eae70

Please sign in to comment.