Skip to content

Commit f62b749

Browse files
committed
all: fix some vet-caught formatting errors, mostly but not only in tests
Could go in 1.5, although not critical. See also golang#12107 Change-Id: I7f1608b58581d21df4db58f0db654fef79e33a90 Reviewed-on: https://go-review.googlesource.com/13481 Reviewed-by: Dave Cheney <dave@cheney.net>
1 parent 39e77bf commit f62b749

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

src/cmd/internal/rsc.io/arm/armasm/ext_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func testExtDis(
178178
t.Logf("%d test cases, %d expected mismatches, %d failures; %.0f cases/second", totalTests, totalSkips, totalErrors, float64(totalTests)/time.Since(start).Seconds())
179179

180180
if err := <-errc; err != nil {
181-
t.Fatal("external disassembler: %v", err)
181+
t.Fatalf("external disassembler: %v", err)
182182
}
183183

184184
}

src/cmd/internal/rsc.io/x86/x86asm/ext_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ func testExtDis(
177177
t.Logf("%d test cases, %d expected mismatches, %d failures; %.0f cases/second", totalTests, totalSkips, totalErrors, float64(totalTests)/time.Since(start).Seconds())
178178

179179
if err := <-errc; err != nil {
180-
t.Fatal("external disassembler: %v", err)
180+
t.Fatalf("external disassembler: %v", err)
181181
}
182182

183183
}

src/crypto/ecdsa/ecdsa_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ func testNonceSafety(t *testing.T, c elliptic.Curve, tag string) {
9191

9292
if s0.Cmp(s1) == 0 {
9393
// This should never happen.
94-
t.Errorf("%s: the signatures on two different messages were the same")
94+
t.Errorf("%s: the signatures on two different messages were the same", tag)
9595
}
9696

9797
if r0.Cmp(r1) == 0 {
98-
t.Errorf("%s: the nonce used for two diferent messages was the same")
98+
t.Errorf("%s: the nonce used for two diferent messages was the same", tag)
9999
}
100100
}
101101

@@ -126,11 +126,11 @@ func testINDCCA(t *testing.T, c elliptic.Curve, tag string) {
126126
}
127127

128128
if s0.Cmp(s1) == 0 {
129-
t.Errorf("%s: two signatures of the same message produced the same result")
129+
t.Errorf("%s: two signatures of the same message produced the same result", tag)
130130
}
131131

132132
if r0.Cmp(r1) == 0 {
133-
t.Errorf("%s: two signatures of the same message produced the same nonce")
133+
t.Errorf("%s: two signatures of the same message produced the same nonce", tag)
134134
}
135135
}
136136

src/crypto/rsa/pkcs1v15_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func TestEncryptPKCS1v15DecrypterSessionKey(t *testing.T) {
160160
}
161161

162162
if test.out != "FAIL" && !bytes.Equal(plaintext, []byte(test.out)) {
163-
t.Errorf("#%d: incorrect plaintext: got %x, want %x", plaintext, test.out)
163+
t.Errorf("#%d: incorrect plaintext: got %x, want %x", i, plaintext, test.out)
164164
}
165165
}
166166
}

src/crypto/tls/handshake_server_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func testClientHelloFailure(t *testing.T, serverConfig *Config, m handshakeMessa
8484
s.Close()
8585
if len(expectedSubStr) == 0 {
8686
if err != nil && err != io.EOF {
87-
t.Errorf("Got error: %s; expected to succeed", err, expectedSubStr)
87+
t.Errorf("Got error: %s; expected to succeed", err)
8888
}
8989
} else if err == nil || !strings.Contains(err.Error(), expectedSubStr) {
9090
t.Errorf("Got error: %s; expected to match substring '%s'", err, expectedSubStr)

src/encoding/gob/codec_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1488,7 +1488,7 @@ func TestErrorInvalidTypeId(t *testing.T) {
14881488
var foo struct{}
14891489
err := d.Decode(&foo)
14901490
if err != errBadType {
1491-
t.Fatal("decode: expected %s, got %s", errBadType, err)
1491+
t.Fatalf("decode: expected %s, got %s", errBadType, err)
14921492
}
14931493
}
14941494
}

src/internal/trace/parser_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestCorruptedInputs(t *testing.T) {
2424
for _, data := range tests {
2525
events, err := Parse(strings.NewReader(data))
2626
if err == nil || events != nil {
27-
t.Fatalf("no error on input: %q\n", t)
27+
t.Fatalf("no error on input: %q\n", data)
2828
}
2929
}
3030
}

src/net/http/transport_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2645,7 +2645,7 @@ func TestTransportFlushesBodyChunks(t *testing.T) {
26452645
req.Header.Set("User-Agent", "x") // known value for test
26462646
res, err := tr.RoundTrip(req)
26472647
if err != nil {
2648-
t.Error("RoundTrip: %v", err)
2648+
t.Errorf("RoundTrip: %v", err)
26492649
close(resc)
26502650
return
26512651
}

src/path/filepath/path_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,18 +402,18 @@ func mark(path string, info os.FileInfo, err error, errors *[]error, clear bool)
402402
func chtmpdir(t *testing.T) (restore func()) {
403403
oldwd, err := os.Getwd()
404404
if err != nil {
405-
t.Fatal("chtmpdir: %v", err)
405+
t.Fatalf("chtmpdir: %v", err)
406406
}
407407
d, err := ioutil.TempDir("", "test")
408408
if err != nil {
409-
t.Fatal("chtmpdir: %v", err)
409+
t.Fatalf("chtmpdir: %v", err)
410410
}
411411
if err := os.Chdir(d); err != nil {
412-
t.Fatal("chtmpdir: %v", err)
412+
t.Fatalf("chtmpdir: %v", err)
413413
}
414414
return func() {
415415
if err := os.Chdir(oldwd); err != nil {
416-
t.Fatal("chtmpdir: %v", err)
416+
t.Fatalf("chtmpdir: %v", err)
417417
}
418418
os.RemoveAll(d)
419419
}

0 commit comments

Comments
 (0)