From 0466af5e49ed223653cf26ef6dd374a25a9413ba Mon Sep 17 00:00:00 2001 From: heyanfu <1145291570@qq.com> Date: Sun, 18 Apr 2021 22:49:03 +0800 Subject: [PATCH] optimize code (#637) --- zrpc/config.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/zrpc/config.go b/zrpc/config.go index 7188ae98..f2114a4e 100644 --- a/zrpc/config.go +++ b/zrpc/config.go @@ -58,13 +58,11 @@ func (sc RpcServerConf) HasEtcd() bool { // Validate validates the config. func (sc RpcServerConf) Validate() error { - if sc.Auth { - if err := sc.Redis.Validate(); err != nil { - return err - } + if !sc.Auth { + return nil } - return nil + return sc.Redis.Validate() } // HasCredential checks if there is a credential in config.