From 9787f3f082be76315a73901dbcd55fa9805d7c6c Mon Sep 17 00:00:00 2001 From: chentao1596 Date: Sat, 31 Dec 2016 23:53:21 +0800 Subject: [PATCH] Fix some go style mistakes about fmt.Errorf --- cmd/sidecar-e2e/main.go | 6 +++--- pkg/dnsmasq/dnsmasq.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/sidecar-e2e/main.go b/cmd/sidecar-e2e/main.go index 614abc40a..5561e8bfa 100644 --- a/cmd/sidecar-e2e/main.go +++ b/cmd/sidecar-e2e/main.go @@ -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: } @@ -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)) } } } @@ -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)) } } diff --git a/pkg/dnsmasq/dnsmasq.go b/pkg/dnsmasq/dnsmasq.go index 80100fb9e..e9ab7b31a 100644 --- a/pkg/dnsmasq/dnsmasq.go +++ b/pkg/dnsmasq/dnsmasq.go @@ -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)) } @@ -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) }