Skip to content

net/textproto: Add support for multi-line Error #6009

Description

@gopherbot

by ruizh.cj:

When trying to send a multi-line response, func (e *Error) Error() string should use the
separator "-" instead of " " in all lines but the last, in
compliance with text-based protocols such as SMTP.

Given the following snippet:
err := textproto.Error{Code: 250, Msg: "localhost at your
service.\nSTARTTLS\n8BITMIME"
fmt.Println(err.Error())

What is the expected output?
250-localhost at your service.
250-STARTTLS
250 8BITMIME

What do you see instead?
250 localhost at your service.
STARTTLS
8BITMIME

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
linux_amd64

Which version are you using?  (run 'go version')
go version go1.1.1 linux/amd64

Please provide any additional information below.
I provide a patch with an example implementation.

Attachments:

  1. multilineError.diff (790 bytes)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions