mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Remove useless if-else
It is better to use simple form without else. Signed-off-by: Hu Keping <hukeping@huawei.com>
This commit is contained in:
parent
196aa6d62d
commit
c536cec5ea
1 changed files with 8 additions and 7 deletions
|
@ -26,13 +26,14 @@ func (cli *DockerCli) CmdLogout(args ...string) error {
|
||||||
|
|
||||||
if _, ok := cli.configFile.AuthConfigs[serverAddress]; !ok {
|
if _, ok := cli.configFile.AuthConfigs[serverAddress]; !ok {
|
||||||
fmt.Fprintf(cli.out, "Not logged in to %s\n", serverAddress)
|
fmt.Fprintf(cli.out, "Not logged in to %s\n", serverAddress)
|
||||||
} else {
|
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue