From c536cec5ea8026b6d93ad53d10bdd2a2cf523d03 Mon Sep 17 00:00:00 2001 From: Hu Keping Date: Sat, 8 Aug 2015 19:47:27 +0800 Subject: [PATCH] Remove useless if-else It is better to use simple form without else. Signed-off-by: Hu Keping --- api/client/logout.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/api/client/logout.go b/api/client/logout.go index e81299b18a..f148548dd4 100644 --- a/api/client/logout.go +++ b/api/client/logout.go @@ -26,13 +26,14 @@ func (cli *DockerCli) CmdLogout(args ...string) error { if _, ok := cli.configFile.AuthConfigs[serverAddress]; !ok { fmt.Fprintf(cli.out, "Not logged in to %s\n", serverAddress) - } else { - fmt.Fprintf(cli.out, "Remove login credentials for %s\n", serverAddress) - delete(cli.configFile.AuthConfigs, serverAddress) - - if err := cli.configFile.Save(); err != nil { - return fmt.Errorf("Failed to save docker config: %v", err) - } + return nil } + + fmt.Fprintf(cli.out, "Remove login credentials for %s\n", serverAddress) + delete(cli.configFile.AuthConfigs, serverAddress) + if err := cli.configFile.Save(); err != nil { + return fmt.Errorf("Failed to save docker config: %v", err) + } + return nil }