Cleanup redundant else statements find via golint #11602

Signed-off-by: George MacRorie <gmacr31@gmail.com>
This commit is contained in:
George MacRorie 2015-03-23 19:21:37 +00:00
parent 65e21f5703
commit 664ef0cbe2
4 changed files with 18 additions and 20 deletions

View File

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

View File

@ -158,14 +158,13 @@ func (sw *shellWord) processDollar() (string, error) {
return sw.getEnv(name), nil
}
return "", fmt.Errorf("Unsupported ${} substitution: %s", sw.word)
} else {
// $xxx case
name := sw.processName()
if name == "" {
return "$", nil
}
return sw.getEnv(name), nil
}
// $xxx case
name := sw.processName()
if name == "" {
return "$", nil
}
return sw.getEnv(name), nil
}
func (sw *shellWord) processName() string {

View File

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

View File

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