From df028d227fc73dce962275887a219edd867ae25b Mon Sep 17 00:00:00 2001 From: zhexuany Date: Sat, 24 Jun 2017 11:28:58 +0800 Subject: [PATCH] undo version --- server/http_status.go | 4 ++-- server/server_test.go | 4 ++-- util/printer/printer.go | 13 ++++++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/server/http_status.go b/server/http_status.go index 00ac2c581a974..a4bc3c3ae8285 100644 --- a/server/http_status.go +++ b/server/http_status.go @@ -25,7 +25,7 @@ import ( "github.com/pingcap/pd/pd-client" "github.com/pingcap/tidb/mysql" "github.com/pingcap/tidb/store/tikv" - "github.com/pingcap/tidb/version" + "github.com/pingcap/tidb/util/printer" "github.com/prometheus/client_golang/prometheus" ) @@ -96,7 +96,7 @@ func (s *Server) handleStatus(w http.ResponseWriter, req *http.Request) { st := status{ Connections: s.ConnectionCount(), Version: mysql.ServerVersion, - GitHash: version.Get().GitCommit, + GitHash: printer.TiDBGitHash, } js, err := json.Marshal(st) if err != nil { diff --git a/server/server_test.go b/server/server_test.go index 3c70561f3744e..6750cb9c59a79 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -31,7 +31,7 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/tidb/executor" tmysql "github.com/pingcap/tidb/mysql" - "github.com/pingcap/tidb/version" + "github.com/pingcap/tidb/util/printer" ) func TestT(t *testing.T) { @@ -517,7 +517,7 @@ func runTestStatusAPI(c *C) { err = decoder.Decode(&data) c.Assert(err, IsNil) c.Assert(data.Version, Equals, tmysql.ServerVersion) - c.Assert(data.GitHash, Equals, version.Get().GitCommit) + c.Assert(data.GitHash, Equals, printer.TiDBGitHash) } func runTestMultiStatements(c *C) { diff --git a/util/printer/printer.go b/util/printer/printer.go index 1fb3c7e1ab430..8fb0bba6f2aa1 100644 --- a/util/printer/printer.go +++ b/util/printer/printer.go @@ -18,19 +18,26 @@ import ( "fmt" "github.com/ngaut/log" - "github.com/pingcap/tidb/version" +) + +// Version information. +var ( + TiDBBuildTS = "None" + TiDBGitHash = "None" ) // PrintTiDBInfo prints the TiDB version information. func PrintTiDBInfo() { log.Infof("Welcome to TiDB.") log.Infof("Version:") - log.Infof("%#v\n", version.Get()) + log.Infof("Git Commit Hash: %s", TiDBGitHash) + log.Infof("UTC Build Time: %s", TiDBBuildTS) } // PrintRawTiDBInfo prints the TiDB version information without log info. func PrintRawTiDBInfo() { - fmt.Printf("%#v\n", version.Get()) + fmt.Println("Git Commit Hash:", TiDBGitHash) + fmt.Println("UTC Build Time: ", TiDBBuildTS) } // checkValidity checks whether cols and every data have the same length.