From 63736bd2bfc680f74ba4e026c1cc4fd3ebf113ed Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Tue, 21 Feb 2012 09:52:37 -0500 Subject: [PATCH] openpgp: fix error strings and typos. Fixes golang/go#2841. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5688054 --- openpgp/errors/errors.go | 14 +++++++------- openpgp/packet/config.go | 3 +-- openpgp/packet/signature.go | 5 +++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/openpgp/errors/errors.go b/openpgp/errors/errors.go index b9016bd..cb3f319 100644 --- a/openpgp/errors/errors.go +++ b/openpgp/errors/errors.go @@ -14,7 +14,7 @@ import ( type StructuralError string func (s StructuralError) Error() string { - return "OpenPGP data invalid: " + string(s) + return "openpgp: invalid data: " + string(s) } // UnsupportedError indicates that, although the OpenPGP data is valid, it @@ -22,7 +22,7 @@ func (s StructuralError) Error() string { type UnsupportedError string func (s UnsupportedError) Error() string { - return "OpenPGP feature unsupported: " + string(s) + return "openpgp: unsupported feature: " + string(s) } // InvalidArgumentError indicates that the caller is in error and passed an @@ -30,7 +30,7 @@ func (s UnsupportedError) Error() string { type InvalidArgumentError string func (i InvalidArgumentError) Error() string { - return "OpenPGP argument invalid: " + string(i) + return "openpgp: invalid argument: " + string(i) } // SignatureError indicates that a syntactically valid signature failed to @@ -38,13 +38,13 @@ func (i InvalidArgumentError) Error() string { type SignatureError string func (b SignatureError) Error() string { - return "OpenPGP signature invalid: " + string(b) + return "openpgp: invalid signature: " + string(b) } type keyIncorrectError int func (ki keyIncorrectError) Error() string { - return "the given key was incorrect" + return "openpgp: incorrect key" } var ErrKeyIncorrect error = keyIncorrectError(0) @@ -52,7 +52,7 @@ var ErrKeyIncorrect error = keyIncorrectError(0) type unknownIssuerError int func (unknownIssuerError) Error() string { - return "signature make by unknown entity" + return "openpgp: signature made by unknown entity" } var ErrUnknownIssuer error = unknownIssuerError(0) @@ -60,5 +60,5 @@ var ErrUnknownIssuer error = unknownIssuerError(0) type UnknownPacketTypeError uint8 func (upte UnknownPacketTypeError) Error() string { - return "unknown OpenPGP packet type: " + strconv.Itoa(int(upte)) + return "openpgp: unknown packet type: " + strconv.Itoa(int(upte)) } diff --git a/openpgp/packet/config.go b/openpgp/packet/config.go index 8fec7be..618da97 100644 --- a/openpgp/packet/config.go +++ b/openpgp/packet/config.go @@ -12,8 +12,7 @@ import ( ) // Config collects a number of parameters along with sensible defaults. - -// A nil *Config is valid and produces all default values. +// A nil *Config is valid and results in all default values. type Config struct { // Rand provides the source of entropy. // If nil, the crypto/rand Reader is used. diff --git a/openpgp/packet/signature.go b/openpgp/packet/signature.go index 7440462..a868405 100644 --- a/openpgp/packet/signature.go +++ b/openpgp/packet/signature.go @@ -483,13 +483,14 @@ func (sig *Signature) SignKey(pub *PublicKey, priv *PrivateKey, config *Config) return sig.Sign(h, priv, config) } -// Serialize marshals sig to w. SignRSA or SignDSA must have been called first. +// Serialize marshals sig to w. Sign, SignUserId or SignKey must have been +// called first. func (sig *Signature) Serialize(w io.Writer) (err error) { if len(sig.outSubpackets) == 0 { sig.outSubpackets = sig.rawSubpackets } if sig.RSASignature.bytes == nil && sig.DSASigR.bytes == nil { - return errors.InvalidArgumentError("Signature: need to call SignRSA or SignDSA before Serialize") + return errors.InvalidArgumentError("Signature: need to call Sign, SignUserId or SignKey before Serialize") } sigLength := 0