diff --git a/builder/parser/line_parsers.go b/builder/parser/line_parsers.go index 3026a0b06d..6e284d6fc3 100644 --- a/builder/parser/line_parsers.go +++ b/builder/parser/line_parsers.go @@ -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 diff --git a/builder/shell_parser.go b/builder/shell_parser.go index b8c746773c..d086645eb0 100644 --- a/builder/shell_parser.go +++ b/builder/shell_parser.go @@ -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 { diff --git a/integration-cli/docker_utils.go b/integration-cli/docker_utils.go index 10cc6c9218..e0b9bacc4a 100644 --- a/integration-cli/docker_utils.go +++ b/integration-cli/docker_utils.go @@ -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 { diff --git a/opts/opts.go b/opts/opts.go index e867c0a21d..df9decf61f 100644 --- a/opts/opts.go +++ b/opts/opts.go @@ -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.