FAQ
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golang-dev@googlegroups.com,

I'd like you to review this change to
https://code.google.com/p/go


Description:
archive/zip: Change t.Fatal to t.Fatalf when format strings are being
used.
crypto/tls: Fixed a bug were the wrong number of arguments were used in
a call to t.Errorf.
net/http: Correct unrecognized format string verb, from "%n" to "%d".

All of the errors above were located using "go vet ./..." in "src/pkg".

Please review this at http://codereview.appspot.com/6856056/

Affected files:
M src/pkg/archive/zip/zip_test.go
M src/pkg/crypto/tls/prf_test.go
M src/pkg/net/http/transfer_test.go


Index: src/pkg/archive/zip/zip_test.go
===================================================================
--- a/src/pkg/archive/zip/zip_test.go
+++ b/src/pkg/archive/zip/zip_test.go
@@ -186,12 +186,12 @@
t.Fatalf("error writing content: %v", err)
}
if err := z.Close(); err != nil {
- t.Fatal("error closing zip writer: %v", err)
+ t.Fatalf("error closing zip writer: %v", err)
}

b := buf.Bytes()
if _, err = NewReader(bytes.NewReader(b), int64(len(b))); err !=
ErrFormat {
- t.Fatal("got %v, expected ErrFormat", err)
+ t.Fatalf("got %v, expected ErrFormat", err)
}
}

Index: src/pkg/crypto/tls/prf_test.go
===================================================================
--- a/src/pkg/crypto/tls/prf_test.go
+++ b/src/pkg/crypto/tls/prf_test.go
@@ -51,7 +51,7 @@

masterSecret := masterFromPreMasterSecret(test.version, in,
clientRandom, serverRandom)
if s := hex.EncodeToString(masterSecret); s != test.masterSecret {
- t.Errorf("#%d: bad master secret %s, want %s", s, test.masterSecret)
+ t.Errorf("#%d: bad master secret %s, want %s", i, s, test.masterSecret)
continue
}

Index: src/pkg/net/http/transfer_test.go
===================================================================
--- a/src/pkg/net/http/transfer_test.go
+++ b/src/pkg/net/http/transfer_test.go
@@ -20,13 +20,13 @@
n, err := b.Read(buf[:3])
got := string(buf[:n])
if got != "foo" || err != nil {
- t.Fatalf(`first Read = %n (%q), %v; want 3 ("foo")`, n, got, err)
+ t.Fatalf(`first Read = %d (%q), %v; want 3 ("foo")`, n, got, err)
}

n, err = b.Read(buf[:])
got = string(buf[:n])
if got != "bar" || err != nil {
- t.Fatalf(`second Read = %n (%q), %v; want 3 ("bar")`, n, got, err)
+ t.Fatalf(`second Read = %d (%q), %v; want 3 ("bar")`, n, got, err)
}

n, err = b.Read(buf[:])

Search Discussions

  • Iant at Nov 17, 2012 at 1:07 am
    Please change first line of description to

    archive/zip, crypto/tls, net/http: Fix print format errors.

    You can still list the specific changes in the rest of the description
    if you like.

    https://codereview.appspot.com/6856056/
  • Iant at Nov 17, 2012 at 1:13 am

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedNov 17, '12 at 1:02a
activeNov 17, '12 at 1:13a
posts3
users2
websitegolang.org

2 users in discussion

Iant: 2 posts R Eklind 87: 1 post

People

Translate

site design / logo © 2021 Grokbase