mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
all: fix some vet-caught formatting errors, mostly but not only in tests
Could go in 1.5, although not critical. See also #12107 Change-Id: I7f1608b58581d21df4db58f0db654fef79e33a90 Reviewed-on: https://go-review.googlesource.com/13481 Reviewed-by: Dave Cheney <dave@cheney.net>
This commit is contained in:
parent
39e77bff85
commit
f62b749ae2
9 changed files with 15 additions and 15 deletions
|
|
@ -178,7 +178,7 @@ func testExtDis(
|
|||
t.Logf("%d test cases, %d expected mismatches, %d failures; %.0f cases/second", totalTests, totalSkips, totalErrors, float64(totalTests)/time.Since(start).Seconds())
|
||||
|
||||
if err := <-errc; err != nil {
|
||||
t.Fatal("external disassembler: %v", err)
|
||||
t.Fatalf("external disassembler: %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ func testExtDis(
|
|||
t.Logf("%d test cases, %d expected mismatches, %d failures; %.0f cases/second", totalTests, totalSkips, totalErrors, float64(totalTests)/time.Since(start).Seconds())
|
||||
|
||||
if err := <-errc; err != nil {
|
||||
t.Fatal("external disassembler: %v", err)
|
||||
t.Fatalf("external disassembler: %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,11 +91,11 @@ func testNonceSafety(t *testing.T, c elliptic.Curve, tag string) {
|
|||
|
||||
if s0.Cmp(s1) == 0 {
|
||||
// This should never happen.
|
||||
t.Errorf("%s: the signatures on two different messages were the same")
|
||||
t.Errorf("%s: the signatures on two different messages were the same", tag)
|
||||
}
|
||||
|
||||
if r0.Cmp(r1) == 0 {
|
||||
t.Errorf("%s: the nonce used for two diferent messages was the same")
|
||||
t.Errorf("%s: the nonce used for two diferent messages was the same", tag)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -126,11 +126,11 @@ func testINDCCA(t *testing.T, c elliptic.Curve, tag string) {
|
|||
}
|
||||
|
||||
if s0.Cmp(s1) == 0 {
|
||||
t.Errorf("%s: two signatures of the same message produced the same result")
|
||||
t.Errorf("%s: two signatures of the same message produced the same result", tag)
|
||||
}
|
||||
|
||||
if r0.Cmp(r1) == 0 {
|
||||
t.Errorf("%s: two signatures of the same message produced the same nonce")
|
||||
t.Errorf("%s: two signatures of the same message produced the same nonce", tag)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ func TestEncryptPKCS1v15DecrypterSessionKey(t *testing.T) {
|
|||
}
|
||||
|
||||
if test.out != "FAIL" && !bytes.Equal(plaintext, []byte(test.out)) {
|
||||
t.Errorf("#%d: incorrect plaintext: got %x, want %x", plaintext, test.out)
|
||||
t.Errorf("#%d: incorrect plaintext: got %x, want %x", i, plaintext, test.out)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ func testClientHelloFailure(t *testing.T, serverConfig *Config, m handshakeMessa
|
|||
s.Close()
|
||||
if len(expectedSubStr) == 0 {
|
||||
if err != nil && err != io.EOF {
|
||||
t.Errorf("Got error: %s; expected to succeed", err, expectedSubStr)
|
||||
t.Errorf("Got error: %s; expected to succeed", err)
|
||||
}
|
||||
} else if err == nil || !strings.Contains(err.Error(), expectedSubStr) {
|
||||
t.Errorf("Got error: %s; expected to match substring '%s'", err, expectedSubStr)
|
||||
|
|
|
|||
|
|
@ -1488,7 +1488,7 @@ func TestErrorInvalidTypeId(t *testing.T) {
|
|||
var foo struct{}
|
||||
err := d.Decode(&foo)
|
||||
if err != errBadType {
|
||||
t.Fatal("decode: expected %s, got %s", errBadType, err)
|
||||
t.Fatalf("decode: expected %s, got %s", errBadType, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func TestCorruptedInputs(t *testing.T) {
|
|||
for _, data := range tests {
|
||||
events, err := Parse(strings.NewReader(data))
|
||||
if err == nil || events != nil {
|
||||
t.Fatalf("no error on input: %q\n", t)
|
||||
t.Fatalf("no error on input: %q\n", data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2645,7 +2645,7 @@ func TestTransportFlushesBodyChunks(t *testing.T) {
|
|||
req.Header.Set("User-Agent", "x") // known value for test
|
||||
res, err := tr.RoundTrip(req)
|
||||
if err != nil {
|
||||
t.Error("RoundTrip: %v", err)
|
||||
t.Errorf("RoundTrip: %v", err)
|
||||
close(resc)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -402,18 +402,18 @@ func mark(path string, info os.FileInfo, err error, errors *[]error, clear bool)
|
|||
func chtmpdir(t *testing.T) (restore func()) {
|
||||
oldwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
t.Fatal("chtmpdir: %v", err)
|
||||
t.Fatalf("chtmpdir: %v", err)
|
||||
}
|
||||
d, err := ioutil.TempDir("", "test")
|
||||
if err != nil {
|
||||
t.Fatal("chtmpdir: %v", err)
|
||||
t.Fatalf("chtmpdir: %v", err)
|
||||
}
|
||||
if err := os.Chdir(d); err != nil {
|
||||
t.Fatal("chtmpdir: %v", err)
|
||||
t.Fatalf("chtmpdir: %v", err)
|
||||
}
|
||||
return func() {
|
||||
if err := os.Chdir(oldwd); err != nil {
|
||||
t.Fatal("chtmpdir: %v", err)
|
||||
t.Fatalf("chtmpdir: %v", err)
|
||||
}
|
||||
os.RemoveAll(d)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue