Skip to content

Commit aea8812

Browse files
adonovangopherbot
authored andcommitted
std: fix printf("%q", int) mistakes
For #72850 Change-Id: I07e64f05c82a34b1dadb9a72e16f5045e68cbd24 Reviewed-on: https://go-review.googlesource.com/c/go/+/720642 Auto-Submit: Alan Donovan <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 120f187 commit aea8812

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

src/cmd/compile/internal/ir/fmt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ func exprFmt(n Node, s fmt.State, prec int) {
574574
// Special case for rune constants.
575575
if typ == types.RuneType || typ == types.UntypedRune {
576576
if x, ok := constant.Uint64Val(val); ok && x <= utf8.MaxRune {
577-
fmt.Fprintf(s, "%q", x)
577+
fmt.Fprintf(s, "%q", rune(x))
578578
return
579579
}
580580
}

src/cmd/vet/testdata/print/print.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func PrintfTests() {
7575
fmt.Printf("%b %b %b %b", 3e9, x, fslice, c)
7676
fmt.Printf("%o %o", 3, i)
7777
fmt.Printf("%p", p)
78-
fmt.Printf("%q %q %q %q", 3, i, 'x', r)
78+
fmt.Printf("%q %q %q", rune(3), 'x', r)
7979
fmt.Printf("%s %s %s", "hi", s, []byte{65})
8080
fmt.Printf("%t %t", true, b)
8181
fmt.Printf("%T %T", 3, i)

src/crypto/rsa/equal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func TestEqual(t *testing.T) {
2121
t.Errorf("public key is not equal to itself: %v", public)
2222
}
2323
if !public.Equal(crypto.Signer(private).Public().(*rsa.PublicKey)) {
24-
t.Errorf("private.Public() is not Equal to public: %q", public)
24+
t.Errorf("private.Public() is not Equal to public: %v", public)
2525
}
2626
if !private.Equal(private) {
2727
t.Errorf("private key is not equal to itself: %v", private)

src/crypto/tls/bogo_shim_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ func bogoShim() {
461461
}
462462

463463
if *expectVersion != 0 && cs.Version != uint16(*expectVersion) {
464-
log.Fatalf("expected ssl version %q, got %q", uint16(*expectVersion), cs.Version)
464+
log.Fatalf("expected ssl version %d, got %d", *expectVersion, cs.Version)
465465
}
466466
if *declineALPN && cs.NegotiatedProtocol != "" {
467467
log.Fatal("unexpected ALPN protocol")

src/database/sql/fakedb_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ func (s *fakeStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (
969969
idx := t.columnIndex(wcol.Column)
970970
if idx == -1 {
971971
t.mu.Unlock()
972-
return nil, fmt.Errorf("fakedb: invalid where clause column %q", wcol)
972+
return nil, fmt.Errorf("fakedb: invalid where clause column %v", wcol)
973973
}
974974
tcol := trow.cols[idx]
975975
if bs, ok := tcol.([]byte); ok {

src/fmt/scan_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -998,7 +998,7 @@ func TestScanStateCount(t *testing.T) {
998998
t.Errorf("bad scan rune: %q %q %q should be '1' '2' '➂'", a.rune, b.rune, c.rune)
999999
}
10001000
if a.size != 1 || b.size != 1 || c.size != 3 {
1001-
t.Errorf("bad scan size: %q %q %q should be 1 1 3", a.size, b.size, c.size)
1001+
t.Errorf("bad scan size: %d %d %d should be 1 1 3", a.size, b.size, c.size)
10021002
}
10031003
}
10041004

src/internal/pkgbits/pkgbits_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func TestRoundTrip(t *testing.T) {
2828
r := pr.NewDecoder(pkgbits.SectionMeta, pkgbits.PublicRootIdx, pkgbits.SyncPublic)
2929

3030
if r.Version() != w.Version() {
31-
t.Errorf("Expected reader version %q to be the writer version %q", r.Version(), w.Version())
31+
t.Errorf("Expected reader version %d to be the writer version %d", r.Version(), w.Version())
3232
}
3333
}
3434
}

src/os/os_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ func TestRenameCaseDifference(pt *testing.T) {
11921192
}
11931193

11941194
if dirNamesLen := len(dirNames); dirNamesLen != 1 {
1195-
t.Fatalf("unexpected dirNames len, got %q, want %q", dirNamesLen, 1)
1195+
t.Fatalf("unexpected dirNames len, got %d, want %d", dirNamesLen, 1)
11961196
}
11971197

11981198
if dirNames[0] != to {

src/reflect/all_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6807,7 +6807,7 @@ func TestMakeFuncStackCopy(t *testing.T) {
68076807
ValueOf(&concrete).Elem().Set(fn)
68086808
x := concrete(nil, 7)
68096809
if x != 9 {
6810-
t.Errorf("have %#q want 9", x)
6810+
t.Errorf("have %d want 9", x)
68116811
}
68126812
}
68136813

0 commit comments

Comments
 (0)