Skip to content

Commit ab98ef0

Browse files
Merge pull request #1168 from sagikazarmark/resubmit-1064
Resubmit #1064
2 parents 274c344 + 1c0d7c9 commit ab98ef0

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

Diff for: auth/jwt/transport_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func TestGRPCToContext(t *testing.T) {
7676
}
7777

7878
// Invalid Authorization header is passed
79-
md["authorization"] = []string{fmt.Sprintf("%s", signedKey)}
79+
md["authorization"] = []string{signedKey}
8080
ctx = reqFunc(context.Background(), md)
8181
token = ctx.Value(JWTContextKey)
8282
if token != nil {

Diff for: metrics/generic/generic.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func (h *Histogram) LabelValues() []string {
182182
func (h *Histogram) Print(w io.Writer) {
183183
h.h.RLock()
184184
defer h.h.RUnlock()
185-
fmt.Fprintf(w, h.h.String())
185+
fmt.Fprint(w, h.h.String())
186186
}
187187

188188
// safeHistogram exists as gohistogram.Histogram is not goroutine-safe.

Diff for: sd/etcd/client_test.go

+6-8
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,12 @@ type fakeWatcher struct {
129129
// When an event occurs it just return nil response and error.
130130
// When an error occur it return a non nil error.
131131
func (fw *fakeWatcher) Next(context.Context) (*etcd.Response, error) {
132-
for {
133-
select {
134-
case <-fw.event:
135-
return nil, nil
136-
case <-fw.err:
137-
return nil, errors.New("error from underlying etcd watcher")
138-
default:
139-
}
132+
select {
133+
case <-fw.event:
134+
return nil, nil
135+
case <-fw.err:
136+
return nil, errors.New("error from underlying etcd watcher")
137+
140138
}
141139
}
142140

Diff for: sd/zk/client_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func TestNewClient(t *testing.T) {
6363
if want, have := sessionTimeout, clientImpl.sessionTimeout; want != have {
6464
t.Errorf("want %d, have %d", want, have)
6565
}
66-
if want, have := payload, clientImpl.rootNodePayload; bytes.Compare(want[0], have[0]) != 0 || bytes.Compare(want[1], have[1]) != 0 {
66+
if want, have := payload, clientImpl.rootNodePayload; !bytes.Equal(want[0], have[0]) || !bytes.Equal(want[1], have[1]) {
6767
t.Errorf("want %s, have %s", want, have)
6868
}
6969

Diff for: transport/http/proto/proto_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package proto
22

33
import (
4+
"context"
45
"io/ioutil"
56
"net/http"
67
"net/http/httptest"
@@ -14,7 +15,7 @@ func TestEncodeProtoRequest(t *testing.T) {
1415

1516
r := httptest.NewRequest(http.MethodGet, "/cat", nil)
1617

17-
err := EncodeProtoRequest(nil, r, cat)
18+
err := EncodeProtoRequest(context.TODO(), r, cat)
1819
if err != nil {
1920
t.Errorf("expected no encoding errors but got: %s", err)
2021
return
@@ -51,7 +52,7 @@ func TestEncodeProtoResponse(t *testing.T) {
5152

5253
wr := httptest.NewRecorder()
5354

54-
err := EncodeProtoResponse(nil, wr, cat)
55+
err := EncodeProtoResponse(context.TODO(), wr, cat)
5556
if err != nil {
5657
t.Errorf("expected no encoding errors but got: %s", err)
5758
return

0 commit comments

Comments
 (0)