From cdc4e572dba1478130806b047df290d46c67f4a3 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Mon, 25 Apr 2022 14:30:43 +0000 Subject: [PATCH] smtp: use bytes.Cut, strings.Cut Merge from net/smtp/smtp.go Obtained from: 4d8db00641cc9ff4f44de7df9b8c4f4a4f9416ee --- smtp.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/smtp.go b/smtp.go index 14ab8c1..50ad638 100644 --- a/smtp.go +++ b/smtp.go @@ -137,12 +137,8 @@ func (c *Client) ehlo() error { if len(extList) > 1 { extList = extList[1:] for _, line := range extList { - args := strings.SplitN(line, " ", 2) - if len(args) > 1 { - ext[args[0]] = args[1] - } else { - ext[args[0]] = "" - } + k, v, _ := strings.Cut(line, " ") + ext[k] = v } } if mechs, ok := ext["AUTH"]; ok {