Browse Source

Merge pull request #1336 from jonboulle/govet

*: fix various formatting issues
Jonathan Boulle 11 years ago
parent
commit
99dd42026b

+ 3 - 3
client/http_test.go

@@ -115,7 +115,7 @@ func TestGetAction(t *testing.T) {
 
 		err := assertResponse(got, wantURL, wantHeader, nil)
 		if err != nil {
-			t.Errorf("%#d: %v", i, err)
+			t.Errorf("#%d: %v", i, err)
 		}
 	}
 }
@@ -164,7 +164,7 @@ func TestWaitAction(t *testing.T) {
 
 		err := assertResponse(got, wantURL, wantHeader, nil)
 		if err != nil {
-			t.Errorf("%#d: %v", i, err)
+			t.Errorf("#%d: %v", i, err)
 		}
 	}
 }
@@ -208,7 +208,7 @@ func TestCreateAction(t *testing.T) {
 
 		err := assertResponse(got, wantURL, wantHeader, []byte(tt.wantBody))
 		if err != nil {
-			t.Errorf("%#d: %v", i, err)
+			t.Errorf("#%d: %v", i, err)
 		}
 	}
 }

+ 1 - 1
discovery/discovery_test.go

@@ -81,7 +81,7 @@ func TestProxyFuncFromEnv(t *testing.T) {
 			t.Errorf("%s: unexpected non-nil err: %v", in, err)
 		}
 		if g.String() != w {
-			t.Errorf("%s: proxyURL=%q, want %q", g, w)
+			t.Errorf("%s: proxyURL=%q, want %q", in, g, w)
 		}
 
 	}

+ 1 - 1
etcdserver/cluster_store_test.go

@@ -114,7 +114,7 @@ func TestClusterStoreDelete(t *testing.T) {
 
 	wdeletes := []string{membersKVPrefix + "1"}
 	if !reflect.DeepEqual(st.deletes, wdeletes) {
-		t.Error("deletes = %v, want %v", st.deletes, wdeletes)
+		t.Errorf("deletes = %v, want %v", st.deletes, wdeletes)
 	}
 }
 

+ 1 - 1
etcdserver/etcdhttp/http.go

@@ -469,7 +469,7 @@ func handleWatch(ctx context.Context, w http.ResponseWriter, wa store.Watcher, s
 			}
 			if err := json.NewEncoder(w).Encode(ev); err != nil {
 				// Should never be reached
-				log.Println("error writing event: %v", err)
+				log.Printf("error writing event: %v\n", err)
 				return
 			}
 			if !stream {

+ 3 - 3
etcdserver/etcdhttp/http_test.go

@@ -695,7 +695,7 @@ func TestSelfServeStatsBad(t *testing.T) {
 			},
 		)
 		if rw.Code != http.StatusMethodNotAllowed {
-			t.Errorf("method %s: code=%d, want %d", m, http.StatusMethodNotAllowed)
+			t.Errorf("method %s: code=%d, want %d", m, rw.Code, http.StatusMethodNotAllowed)
 		}
 	}
 }
@@ -711,7 +711,7 @@ func TestLeaderServeStatsBad(t *testing.T) {
 			},
 		)
 		if rw.Code != http.StatusMethodNotAllowed {
-			t.Errorf("method %s: code=%d, want %d", m, http.StatusMethodNotAllowed)
+			t.Errorf("method %s: code=%d, want %d", m, rw.Code, http.StatusMethodNotAllowed)
 		}
 	}
 }
@@ -1226,7 +1226,7 @@ func TestHandleWatch(t *testing.T) {
 		wrt := "5"
 
 		if rr.Code != wcode {
-			t.Errorf("#%d: got code=%d, want %d", rr.Code, wcode)
+			t.Errorf("#%d: got code=%d, want %d", i, rr.Code, wcode)
 		}
 		h := rr.Header()
 		if ct := h.Get("Content-Type"); ct != wct {

+ 2 - 2
etcdserver/server_test.go

@@ -988,8 +988,8 @@ func TestPublishRetry(t *testing.T) {
 
 	action := n.Action()
 	// multiple Proposes
-	if len(action) < 2 {
-		t.Errorf("len(action) = %d, want >= 2", action)
+	if n := len(action); n < 2 {
+		t.Errorf("len(action) = %d, want >= 2", n)
 	}
 }
 

+ 1 - 1
pkg/flags/ipaddressport_test.go

@@ -54,7 +54,7 @@ func TestIPAddressPortSet(t *testing.T) {
 	for i, tt := range fail {
 		f := &IPAddressPort{}
 		if err := f.Set(tt); err == nil {
-			t.Errorf("#%d: expected error from IPAddressPort.Set(%q)", i, tt, err)
+			t.Errorf("#%d: expected error from IPAddressPort.Set(%q)", i, tt)
 		}
 	}
 }

+ 3 - 3
pkg/transport/listener_test.go

@@ -85,7 +85,7 @@ func TestNewTransportTLSInfo(t *testing.T) {
 
 		gotTLSClientConfig := trans.TLSClientConfig != nil
 		if tt.wantTLSClientConfig != gotTLSClientConfig {
-			t.Fatalf("%#d: wantTLSClientConfig=%t but gotTLSClientConfig=%t", i, tt.wantTLSClientConfig, gotTLSClientConfig)
+			t.Fatalf("#%d: wantTLSClientConfig=%t but gotTLSClientConfig=%t", i, tt.wantTLSClientConfig, gotTLSClientConfig)
 		}
 	}
 }
@@ -193,7 +193,7 @@ func TestTLSInfoConfigFuncs(t *testing.T) {
 		}
 
 		if tt.wantCAs != (sCfg.ClientCAs != nil) {
-			t.Errorf("%#d: wantCAs=%t but ClientCAs=%v", i, tt.wantCAs, sCfg.ClientCAs)
+			t.Errorf("#%d: wantCAs=%t but ClientCAs=%v", i, tt.wantCAs, sCfg.ClientCAs)
 		}
 
 		cCfg, err := tt.info.ClientConfig()
@@ -202,7 +202,7 @@ func TestTLSInfoConfigFuncs(t *testing.T) {
 		}
 
 		if tt.wantCAs != (cCfg.RootCAs != nil) {
-			t.Errorf("%#d: wantCAs=%t but RootCAs=%v", i, tt.wantCAs, sCfg.RootCAs)
+			t.Errorf("#%d: wantCAs=%t but RootCAs=%v", i, tt.wantCAs, sCfg.RootCAs)
 		}
 	}
 }