]> Cypherpunks repositories - gostls13.git/commitdiff
std: fix printf("%q", int) mistakes
authorAlan Donovan <adonovan@google.com>
Fri, 14 Nov 2025 19:59:36 +0000 (14:59 -0500)
committerGopher Robot <gobot@golang.org>
Fri, 14 Nov 2025 22:05:53 +0000 (14:05 -0800)
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>

src/cmd/compile/internal/ir/fmt.go
src/cmd/vet/testdata/print/print.go
src/crypto/rsa/equal_test.go
src/crypto/tls/bogo_shim_test.go
src/database/sql/fakedb_test.go
src/fmt/scan_test.go
src/internal/pkgbits/pkgbits_test.go
src/os/os_test.go
src/reflect/all_test.go

index ae4ff62652eac01998aba60ff4ba3f3098d45ab7..eb64cce47bf9410f3f40d178cb18ae2b67e9f494 100644 (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
                        }
                }
index 3761da420bea3c12e9b251549ef8165bc2c8d68b..9145c12fb809f3f2c9b82b94681d6d130b1a0786 100644 (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)
index 435429c3d156359d17a46b45f9d87ad4ad043523..39a9cdc86cfaf5cdeda4fef1b8e6974875ea49fa 100644 (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)
index 8f171d925959c81756e3c25d2f69931f71a2f504..02a943c13cfdd923139b12c95171412d29ec6257 100644 (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")
index 003e6c62986f31a071acf8a11f10b7ccf92893a5..e5f04593033779791de26f2490a57578292cfbdb 100644 (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 {
index a4f80c23c2410063f25c212e6227f01c9a9553f1..ff9e4f30ca8c873f89457c4f8fa2fcf62453a9a6 100644 (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)
        }
 }
 
index a4755bd35a4e5e1828b4e33bf699357938a35f21..f67267189f5edea4f356ac1a689421a2b1e9bf4e 100644 (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())
                }
        }
 }
index 536734901baff61af9bebf80dcc1f2d816dda39b..29f2e6d3b2258c8123d6fc25ced496b8cad022bf 100644 (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 {
index 8509f00a5eeef6dcd000b9fc0f14c5d23e3e57ee..30ec3fad512f3bdcaae2300a10b3ded05741ead4 100644 (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)
        }
 }