1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #11657 from GeorgeMac/cleanup-redundant-else

#11602 - Cleanup redundant else statements find via golint
This commit is contained in:
Tibor Vass 2015-03-23 18:27:29 -05:00
commit 92f9e2d395
4 changed files with 18 additions and 20 deletions

View file

@ -239,9 +239,11 @@ func parseJSON(rest string) (*Node, map[string]bool, error) {
var top, prev *Node var top, prev *Node
for _, str := range myJson { for _, str := range myJson {
if s, ok := str.(string); !ok { s, ok := str.(string)
if !ok {
return nil, nil, errDockerfileNotStringArray return nil, nil, errDockerfileNotStringArray
} else { }
node := &Node{Value: s} node := &Node{Value: s}
if prev == nil { if prev == nil {
top = node top = node
@ -250,7 +252,6 @@ func parseJSON(rest string) (*Node, map[string]bool, error) {
} }
prev = node prev = node
} }
}
return top, map[string]bool{"json": true}, nil return top, map[string]bool{"json": true}, nil
} }

View file

@ -158,7 +158,7 @@ func (sw *shellWord) processDollar() (string, error) {
return sw.getEnv(name), nil return sw.getEnv(name), nil
} }
return "", fmt.Errorf("Unsupported ${} substitution: %s", sw.word) return "", fmt.Errorf("Unsupported ${} substitution: %s", sw.word)
} else { }
// $xxx case // $xxx case
name := sw.processName() name := sw.processName()
if name == "" { if name == "" {
@ -166,7 +166,6 @@ func (sw *shellWord) processDollar() (string, error) {
} }
return sw.getEnv(name), nil return sw.getEnv(name), nil
} }
}
func (sw *shellWord) processName() string { func (sw *shellWord) processName() string {
// Read in a name (alphanumeric or _) // Read in a name (alphanumeric or _)

View file

@ -395,9 +395,8 @@ func getSliceOfPausedContainers() ([]string, error) {
if err == nil { if err == nil {
slice := strings.Split(strings.TrimSpace(out), "\n") slice := strings.Split(strings.TrimSpace(out), "\n")
return slice, err return slice, err
} else {
return []string{out}, err
} }
return []string{out}, err
} }
func unpauseContainer(container string) error { func unpauseContainer(container string) error {

View file

@ -192,9 +192,8 @@ func ValidateMACAddress(val string) (string, error) {
_, err := net.ParseMAC(strings.TrimSpace(val)) _, err := net.ParseMAC(strings.TrimSpace(val))
if err != nil { if err != nil {
return "", err return "", err
} else {
return val, nil
} }
return val, nil
} }
// Validates domain for resolvconf search configuration. // Validates domain for resolvconf search configuration.