mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
clean some redundant else clauses
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
parent
472538bee0
commit
d91ae65280
3 changed files with 9 additions and 11 deletions
|
@ -23,10 +23,9 @@ func (cli *DockerCli) CmdHelp(args ...string) error {
|
||||||
method, exists := cli.getMethod(args[0])
|
method, exists := cli.getMethod(args[0])
|
||||||
if !exists {
|
if !exists {
|
||||||
return fmt.Errorf("docker: '%s' is not a docker command. See 'docker --help'.", args[0])
|
return fmt.Errorf("docker: '%s' is not a docker command. See 'docker --help'.", args[0])
|
||||||
} else {
|
|
||||||
method("--help")
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
method("--help")
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
|
|
|
@ -307,11 +307,11 @@ func InitDriver(config *Config) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if gateway, err := requestDefaultGateway(config.DefaultGatewayIPv4, bridgeIPv4Network); err != nil {
|
gateway, err := requestDefaultGateway(config.DefaultGatewayIPv4, bridgeIPv4Network)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
|
||||||
gatewayIPv4 = gateway
|
|
||||||
}
|
}
|
||||||
|
gatewayIPv4 = gateway
|
||||||
|
|
||||||
if config.FixedCIDRv6 != "" {
|
if config.FixedCIDRv6 != "" {
|
||||||
_, subnet, err := net.ParseCIDR(config.FixedCIDRv6)
|
_, subnet, err := net.ParseCIDR(config.FixedCIDRv6)
|
||||||
|
@ -325,11 +325,11 @@ func InitDriver(config *Config) error {
|
||||||
}
|
}
|
||||||
globalIPv6Network = subnet
|
globalIPv6Network = subnet
|
||||||
|
|
||||||
if gateway, err := requestDefaultGateway(config.DefaultGatewayIPv6, globalIPv6Network); err != nil {
|
gateway, err := requestDefaultGateway(config.DefaultGatewayIPv6, globalIPv6Network)
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
|
||||||
gatewayIPv6 = gateway
|
|
||||||
}
|
}
|
||||||
|
gatewayIPv6 = gateway
|
||||||
}
|
}
|
||||||
|
|
||||||
// Block BridgeIP in IP allocator
|
// Block BridgeIP in IP allocator
|
||||||
|
|
|
@ -26,7 +26,6 @@ func HumanDuration(d time.Duration) string {
|
||||||
return fmt.Sprintf("%d weeks", hours/24/7)
|
return fmt.Sprintf("%d weeks", hours/24/7)
|
||||||
} else if hours < 24*365*2 {
|
} else if hours < 24*365*2 {
|
||||||
return fmt.Sprintf("%d months", hours/24/30)
|
return fmt.Sprintf("%d months", hours/24/30)
|
||||||
} else {
|
|
||||||
return fmt.Sprintf("%d years", hours/24/365)
|
|
||||||
}
|
}
|
||||||
|
return fmt.Sprintf("%d years", int(d.Hours())/24/365)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue