Skip to content

Commit

Permalink
Merge pull request #16 from chentao1596/go-style-mistakes
Browse files Browse the repository at this point in the history
Fix some go style mistakes about fmt.Errorf
  • Loading branch information
bowei authored Jan 4, 2017
2 parents a69fcde + 0388e24 commit dd1d082
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cmd/sidecar-e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func waitForTcpOrExit(cmd *exec.Cmd, endpoint string) error {
// Check to see that the process has not died early.
select {
case err := <-exitChan:
return true, fmt.Errorf("Process died: %v", err)
return true, fmt.Errorf("process died: %v", err)
default:
}

Expand Down Expand Up @@ -400,7 +400,7 @@ func (t *test) runDig() {
if err == nil {
t.digOutput += string(output)
} else {
t.errors = append(t.errors, fmt.Errorf("Error running dig: %v", err))
t.errors = append(t.errors, fmt.Errorf("error running dig: %v", err))
}
}
}
Expand Down Expand Up @@ -517,6 +517,6 @@ func main() {
break

default:
log.Fatal(fmt.Errorf("Invalid --mode: %v", opts.mode))
log.Fatal(fmt.Errorf("invalid --mode: %v", opts.mode))
}
}
6 changes: 3 additions & 3 deletions pkg/dnsmasq/dnsmasq.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ func (mc *metricsClient) getSingleMetric(name string) (int64, error) {
}

if len(in.Answer) != 1 {
return 0, fmt.Errorf("Invalid number of Answer records for %s: %d",
return 0, fmt.Errorf("invalid number of Answer records for %s: %d",
name, len(in.Answer))
}

if t, ok := in.Answer[0].(*dns.TXT); ok {
glog.V(4).Infof("Got valid TXT response %+v for %s", t, name)
if len(t.Txt) != 1 {
return 0, fmt.Errorf("Invalid number of TXT records for %s: %d",
return 0, fmt.Errorf("invalid number of TXT records for %s: %d",
name, len(t.Txt))
}

Expand All @@ -124,5 +124,5 @@ func (mc *metricsClient) getSingleMetric(name string) (int64, error) {
return value, nil
}

return 0, fmt.Errorf("missing txt record for %s", name)
return 0, fmt.Errorf("missing TXT record for %s", name)
}

0 comments on commit dd1d082

Please sign in to comment.