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 <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Alan Donovan 2025-11-14 14:59:36 -05:00 committed by Gopher Robot
parent 120f1874ef
commit aea881230d
9 changed files with 9 additions and 9 deletions

View file

@ -574,7 +574,7 @@ func exprFmt(n Node, s fmt.State, prec int) {
// Special case for rune constants.
if typ == types.RuneType || typ == types.UntypedRune {
if x, ok := constant.Uint64Val(val); ok && x <= utf8.MaxRune {
fmt.Fprintf(s, "%q", x)
fmt.Fprintf(s, "%q", rune(x))
return
}
}

View file

@ -75,7 +75,7 @@ func PrintfTests() {
fmt.Printf("%b %b %b %b", 3e9, x, fslice, c)
fmt.Printf("%o %o", 3, i)
fmt.Printf("%p", p)
fmt.Printf("%q %q %q %q", 3, i, 'x', r)
fmt.Printf("%q %q %q", rune(3), 'x', r)
fmt.Printf("%s %s %s", "hi", s, []byte{65})
fmt.Printf("%t %t", true, b)
fmt.Printf("%T %T", 3, i)

View file

@ -21,7 +21,7 @@ func TestEqual(t *testing.T) {
t.Errorf("public key is not equal to itself: %v", public)
}
if !public.Equal(crypto.Signer(private).Public().(*rsa.PublicKey)) {
t.Errorf("private.Public() is not Equal to public: %q", public)
t.Errorf("private.Public() is not Equal to public: %v", public)
}
if !private.Equal(private) {
t.Errorf("private key is not equal to itself: %v", private)

View file

@ -461,7 +461,7 @@ func bogoShim() {
}
if *expectVersion != 0 && cs.Version != uint16(*expectVersion) {
log.Fatalf("expected ssl version %q, got %q", uint16(*expectVersion), cs.Version)
log.Fatalf("expected ssl version %d, got %d", *expectVersion, cs.Version)
}
if *declineALPN && cs.NegotiatedProtocol != "" {
log.Fatal("unexpected ALPN protocol")

View file

@ -969,7 +969,7 @@ func (s *fakeStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (
idx := t.columnIndex(wcol.Column)
if idx == -1 {
t.mu.Unlock()
return nil, fmt.Errorf("fakedb: invalid where clause column %q", wcol)
return nil, fmt.Errorf("fakedb: invalid where clause column %v", wcol)
}
tcol := trow.cols[idx]
if bs, ok := tcol.([]byte); ok {

View file

@ -998,7 +998,7 @@ func TestScanStateCount(t *testing.T) {
t.Errorf("bad scan rune: %q %q %q should be '1' '2' '➂'", a.rune, b.rune, c.rune)
}
if a.size != 1 || b.size != 1 || c.size != 3 {
t.Errorf("bad scan size: %q %q %q should be 1 1 3", a.size, b.size, c.size)
t.Errorf("bad scan size: %d %d %d should be 1 1 3", a.size, b.size, c.size)
}
}

View file

@ -28,7 +28,7 @@ func TestRoundTrip(t *testing.T) {
r := pr.NewDecoder(pkgbits.SectionMeta, pkgbits.PublicRootIdx, pkgbits.SyncPublic)
if r.Version() != w.Version() {
t.Errorf("Expected reader version %q to be the writer version %q", r.Version(), w.Version())
t.Errorf("Expected reader version %d to be the writer version %d", r.Version(), w.Version())
}
}
}

View file

@ -1192,7 +1192,7 @@ func TestRenameCaseDifference(pt *testing.T) {
}
if dirNamesLen := len(dirNames); dirNamesLen != 1 {
t.Fatalf("unexpected dirNames len, got %q, want %q", dirNamesLen, 1)
t.Fatalf("unexpected dirNames len, got %d, want %d", dirNamesLen, 1)
}
if dirNames[0] != to {

View file

@ -6807,7 +6807,7 @@ func TestMakeFuncStackCopy(t *testing.T) {
ValueOf(&concrete).Elem().Set(fn)
x := concrete(nil, 7)
if x != 9 {
t.Errorf("have %#q want 9", x)
t.Errorf("have %d want 9", x)
}
}