Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Unified Diff: src/pkg/crypto/openpgp/write_test.go

Issue 4670051: code review 4670051: crypto/openpgp: use new(bytes.Buffer) where possible
Patch Set: diff -r aa01a846e2b2 https://go.googlecode.com/hg/ Created 14 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/crypto/openpgp/packet/symmetrically_encrypted_test.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/crypto/openpgp/write_test.go
===================================================================
--- a/src/pkg/crypto/openpgp/write_test.go
+++ b/src/pkg/crypto/openpgp/write_test.go
@@ -16,7 +16,7 @@
func TestSignDetached(t *testing.T) {
kring, _ := ReadKeyRing(readerFromHex(testKeys1And2PrivateHex))
- out := bytes.NewBuffer(nil)
+ out := new(bytes.Buffer)
message := bytes.NewBufferString(signedInput)
err := DetachSign(out, kring[0], message)
if err != nil {
@@ -28,7 +28,7 @@
func TestSignTextDetached(t *testing.T) {
kring, _ := ReadKeyRing(readerFromHex(testKeys1And2PrivateHex))
- out := bytes.NewBuffer(nil)
+ out := new(bytes.Buffer)
message := bytes.NewBufferString(signedInput)
err := DetachSignText(out, kring[0], message)
if err != nil {
@@ -40,7 +40,7 @@
func TestSignDetachedDSA(t *testing.T) {
kring, _ := ReadKeyRing(readerFromHex(dsaTestKeyPrivateHex))
- out := bytes.NewBuffer(nil)
+ out := new(bytes.Buffer)
message := bytes.NewBufferString(signedInput)
err := DetachSign(out, kring[0], message)
if err != nil {
@@ -61,7 +61,7 @@
return
}
- w := bytes.NewBuffer(nil)
+ w := new(bytes.Buffer)
if err := e.SerializePrivate(w); err != nil {
t.Errorf("failed to serialize entity: %s", err)
return
@@ -78,7 +78,7 @@
t.Errorf("wrong number of entities found, got %d, want 1", len(el))
}
- w = bytes.NewBuffer(nil)
+ w = new(bytes.Buffer)
if err := e.SerializePrivate(w); err != nil {
t.Errorf("failed to serialize entity second time: %s", err)
return
@@ -112,7 +112,7 @@
if err != nil {
t.Errorf("error rereading message: %s", err)
}
- messageBuf := bytes.NewBuffer(nil)
+ messageBuf := new(bytes.Buffer)
_, err = io.Copy(messageBuf, md.UnverifiedBody)
if err != nil {
t.Errorf("error rereading message: %s", err)
« no previous file with comments | « src/pkg/crypto/openpgp/packet/symmetrically_encrypted_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b