diff --git a/src/pkg/encoding/pem/pem.go b/src/pkg/encoding/pem/pem.go index f39540756b..5653aeb77c 100644 --- a/src/pkg/encoding/pem/pem.go +++ b/src/pkg/encoding/pem/pem.go @@ -218,14 +218,13 @@ func Encode(out io.Writer, b *Block) (err os.Error) { return } - for k, v := range b.Headers { - _, err = out.Write([]byte(k + ": " + v + "\n")) - if err != nil { - return + if len(b.Headers) > 0 { + for k, v := range b.Headers { + _, err = out.Write([]byte(k + ": " + v + "\n")) + if err != nil { + return + } } - } - - if len(b.Headers) > 1 { _, err = out.Write([]byte{'\n'}) if err != nil { return