aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2019-01-29 05:37:17 +0700
committerShulhan <ms@kilabit.info>2019-01-29 21:35:08 +0700
commit5318a341942a09335b169bd4c2e2ebe0c6cec004 (patch)
treede082c2d3f1bdb2e1223f04e37af49a296422eb2
parent4b6ebf79fafdeb2c8a3abf8d8766eb3eb4412626 (diff)
downloadpakakeh.go-5318a341942a09335b169bd4c2e2ebe0c6cec004.tar.xz
lib/smtp: simplify single switch-case and if-else condition
-rw-r--r--lib/smtp/handler_test.go3
-rw-r--r--lib/smtp/receiver.go6
2 files changed, 3 insertions, 6 deletions
diff --git a/lib/smtp/handler_test.go b/lib/smtp/handler_test.go
index 47c2f54b..7a301517 100644
--- a/lib/smtp/handler_test.go
+++ b/lib/smtp/handler_test.go
@@ -28,8 +28,7 @@ func (th *testHandler) ServeBounce(mail *MailTx) (res *Response, err error) {
func (th *testHandler) ServeExpand(mailingList string) (res *Response, err error) {
res = &Response{}
- switch mailingList {
- case "list-exist":
+ if mailingList == "list-exist" {
res.Code = StatusOK
res.Message = "List Exist"
res.Body = []string{
diff --git a/lib/smtp/receiver.go b/lib/smtp/receiver.go
index a70f159c..2aef8b53 100644
--- a/lib/smtp/receiver.go
+++ b/lib/smtp/receiver.go
@@ -159,10 +159,8 @@ func (recv *receiver) sendError(errRes error) (err error) {
if !ok {
reply.Code = StatusLocalError
reply.Message = errRes.Error()
- } else {
- if reply.Code == 0 {
- reply.Code = StatusLocalError
- }
+ } else if reply.Code == 0 {
+ reply.Code = StatusLocalError
}
_, err = fmt.Fprintf(recv.conn, "%d %s\r\n", reply.Code, reply.Message)