Skip to content

Commit 7c36036

Browse files
dmitshurgopherbot
authored andcommitted
http2, webdav, websocket: fix %q verb uses with wrong type
Caught early by the improved vet check gated behind the 1.26 language version combined with a tiplang builder that tests with 1.26 language version. Fixes golang/go#76574. Fixes golang/go#76599. Fixes golang/go#76547. Change-Id: If8e2266013df0a39fc980a1e9287f8cb75949811 Cq-Include-Trybots: luci.golang.try:x_net-gotip-linux-amd64-tiplang Reviewed-on: https://go-review.googlesource.com/c/net/+/725220 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Commit-Queue: Alan Donovan <adonovan@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Alan Donovan <adonovan@google.com>
1 parent ec11ecc commit 7c36036

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

http2/server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1977,7 +1977,7 @@ func TestServerRejectsContentLengthWithSignNewRequests(t *testing.T) {
19771977
}
19781978
checkReq := func(r *http.Request) {
19791979
if r.ContentLength != tt.wantCL {
1980-
t.Fatalf("Got: %q\nWant: %q", r.ContentLength, tt.wantCL)
1980+
t.Fatalf("Got: %d\nWant: %d", r.ContentLength, tt.wantCL)
19811981
}
19821982
}
19831983
testServerRequest(t, writeReq, checkReq)

webdav/prop_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ func TestMemPS(t *testing.T) {
556556
sort.Sort(byStatus(propstats))
557557
sort.Sort(byStatus(op.wantPropstats))
558558
if !reflect.DeepEqual(propstats, op.wantPropstats) {
559-
t.Errorf("%s: propstat\ngot %q\nwant %q", desc, propstats, op.wantPropstats)
559+
t.Errorf("%s: propstat\ngot %#v\nwant %#v", desc, propstats, op.wantPropstats)
560560
}
561561
}
562562
}

websocket/hybi_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Sec-WebSocket-Version: 13
190190
t.Errorf("handshake failed: %v", err)
191191
}
192192
if code != http.StatusSwitchingProtocols {
193-
t.Errorf("status expected %q but got %q", http.StatusSwitchingProtocols, code)
193+
t.Errorf("status expected %d but got %d", http.StatusSwitchingProtocols, code)
194194
}
195195
expectedProtocols := []string{"chat", "superchat"}
196196
if fmt.Sprintf("%v", config.Protocol) != fmt.Sprintf("%v", expectedProtocols) {
@@ -239,10 +239,10 @@ Sec-WebSocket-Version: 13
239239
t.Errorf("handshake failed: %v", err)
240240
}
241241
if code != http.StatusSwitchingProtocols {
242-
t.Errorf("status expected %q but got %q", http.StatusSwitchingProtocols, code)
242+
t.Errorf("status expected %d but got %d", http.StatusSwitchingProtocols, code)
243243
}
244244
if len(config.Protocol) != 0 {
245-
t.Errorf("len(config.Protocol) expected 0, but got %q", len(config.Protocol))
245+
t.Errorf("len(config.Protocol) expected 0, but got %d", len(config.Protocol))
246246
}
247247
b := bytes.NewBuffer([]byte{})
248248
bw := bufio.NewWriter(b)
@@ -285,7 +285,7 @@ Sec-WebSocket-Version: 9
285285
t.Errorf("handshake expected err %q but got %q", ErrBadWebSocketVersion, err)
286286
}
287287
if code != http.StatusBadRequest {
288-
t.Errorf("status expected %q but got %q", http.StatusBadRequest, code)
288+
t.Errorf("status expected %d but got %d", http.StatusBadRequest, code)
289289
}
290290
}
291291

@@ -583,7 +583,7 @@ Sec-WebSocket-Version: 13
583583
t.Errorf("handshake failed: %v", err)
584584
}
585585
if code != http.StatusSwitchingProtocols {
586-
t.Errorf("status expected %q but got %q", http.StatusSwitchingProtocols, code)
586+
t.Errorf("status expected %d but got %d", http.StatusSwitchingProtocols, code)
587587
}
588588
b := bytes.NewBuffer([]byte{})
589589
bw := bufio.NewWriter(b)

websocket/websocket_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ func TestHTTP(t *testing.T) {
323323
return
324324
}
325325
if resp.StatusCode != http.StatusBadRequest {
326-
t.Errorf("Get: expected %q got %q", http.StatusBadRequest, resp.StatusCode)
326+
t.Errorf("Get: expected %d got %d", http.StatusBadRequest, resp.StatusCode)
327327
}
328328
}
329329

0 commit comments

Comments
 (0)