Skip to content

Commit fc70528

Browse files
authored
util: use runtime.Version() to get Go version (pingcap#53619) (pingcap#55536)
close pingcap#53618
1 parent ce5bdfe commit fc70528

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

util/printer/printer.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import (
1818
"bytes"
1919
"encoding/json"
2020
"fmt"
21-
_ "runtime" // import link package
22-
_ "unsafe" // required by go:linkname
21+
"runtime"
2322

2423
"github.com/pingcap/tidb/config"
2524
"github.com/pingcap/tidb/parser/mysql"
@@ -29,6 +28,12 @@ import (
2928
"go.uber.org/zap"
3029
)
3130

31+
var buildVersion string
32+
33+
func init() {
34+
buildVersion = runtime.Version()
35+
}
36+
3237
// PrintTiDBInfo prints the TiDB version information.
3338
func PrintTiDBInfo() {
3439
logutil.BgLogger().Info("Welcome to TiDB.",
@@ -167,6 +172,3 @@ func GetPrintResult(cols []string, datas [][]string) (string, bool) {
167172
value = append(value, getPrintDivLine(maxColLen)...)
168173
return string(value), true
169174
}
170-
171-
//go:linkname buildVersion runtime.buildVersion
172-
var buildVersion string

0 commit comments

Comments
 (0)