optimize code style

This commit is contained in:
finley
2023-03-19 16:19:25 +08:00
parent d7f6420f69
commit c96b0bf5a0

View File

@@ -33,11 +33,8 @@ func Info(c redis.Connection, args [][]byte) redis.Reply {
reply := GenGodisInfoString() reply := GenGodisInfoString()
return protocol.MakeBulkReply(reply) return protocol.MakeBulkReply(reply)
} }
} else {
return protocol.MakeErrReply("ERR wrong number of arguments for 'info' command")
} }
return protocol.MakeErrReply("ERR wrong number of arguments for 'info' command")
return &protocol.NullBulkReply{}
} }
// Auth validate client's password // Auth validate client's password
@@ -64,7 +61,7 @@ func isAuthenticated(c redis.Connection) bool {
} }
func GenGodisInfoString() []byte { func GenGodisInfoString() []byte {
startUpTimeFromNow := getGodisRuninngTime() startUpTimeFromNow := getGodisRunningTime()
s := fmt.Sprintf("# Server\r\n"+ s := fmt.Sprintf("# Server\r\n"+
"godis_version:%s\r\n"+ "godis_version:%s\r\n"+
//"godis_git_sha1:%s\r\n"+ //"godis_git_sha1:%s\r\n"+
@@ -112,7 +109,7 @@ func getGodisRunningMode() string {
} }
} }
// getGodisRuninngTime return the running time of godis // getGodisRunningTime return the running time of godis
func getGodisRuninngTime() time.Duration { func getGodisRunningTime() time.Duration {
return time.Since(config.EachTimeServerInfo.StartUpTime) / time.Second return time.Since(config.EachTimeServerInfo.StartUpTime) / time.Second
} }