Skip to content

Commit 1b46251

Browse files
authored
util: use runtime.Version() to get Go version (#53619) (#55534)
close #53618
1 parent 509f9dd commit 1b46251

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
fields := []zap.Field{
@@ -178,6 +183,3 @@ func GetPrintResult(cols []string, datas [][]string) (string, bool) {
178183
value = append(value, getPrintDivLine(maxColLen)...)
179184
return string(value), true
180185
}
181-
182-
//go:linkname buildVersion runtime.buildVersion
183-
var buildVersion string

0 commit comments

Comments
 (0)