From 07a1f385b79aa0c9d5a3dbabb096536810cb47e3 Mon Sep 17 00:00:00 2001 From: Alexandre Cesaro Date: Wed, 22 Jul 2015 22:38:02 +0200 Subject: [PATCH] Simplified some code --- message.go | 4 ++-- writeto.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/message.go b/message.go index 42e00aa..2e2ce7c 100644 --- a/message.go +++ b/message.go @@ -200,7 +200,7 @@ func (m *Message) DelHeader(field string) { // SetBody sets the body of the message. func (m *Message) SetBody(contentType, body string) { m.parts = []part{ - part{ + { contentType: contentType, copier: func(w io.Writer) error { _, err := io.WriteString(w, body) @@ -243,7 +243,7 @@ func (m *Message) AddAlternative(contentType, body string) { // }) func (m *Message) AddAlternativeWriter(contentType string, f func(io.Writer) error) { m.parts = []part{ - part{ + { contentType: contentType, copier: f, }, diff --git a/writeto.go b/writeto.go index efe4123..cdc10a0 100644 --- a/writeto.go +++ b/writeto.go @@ -40,8 +40,8 @@ func (w *messageWriter) writeMessage(m *Message) { for _, part := range m.parts { contentType := part.contentType + "; charset=" + m.charset w.writeHeaders(map[string][]string{ - "Content-Type": []string{contentType}, - "Content-Transfer-Encoding": []string{string(m.encoding)}, + "Content-Type": {contentType}, + "Content-Transfer-Encoding": {string(m.encoding)}, }) w.writeBody(part.copier, m.encoding) } @@ -91,7 +91,7 @@ func (w *messageWriter) openMultipart(mimeType string) { w.writeString("\r\n") } else { w.createPart(map[string][]string{ - "Content-Type": []string{contentType}, + "Content-Type": {contentType}, }) } w.depth++