1
0
mirror of https://github.com/golang/go synced 2024-11-22 01:14:40 -07:00

pem: print \n after 1 header line too

rearrange to make reason for if clear.

Fixes #911.

R=agl1
CC=golang-dev
https://golang.org/cl/1774044
This commit is contained in:
Russ Cox 2010-07-12 16:48:49 -07:00
parent ccd28e8eb6
commit 36560d2b4a

View File

@ -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