From 56b8f0793f036727aeb0a45968c6f69e260775e6 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 16 Nov 2017 15:29:06 -0500 Subject: begone with goto --- textproto/io.go | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/textproto/io.go b/textproto/io.go index cb0105b..9e8f532 100644 --- a/textproto/io.go +++ b/textproto/io.go @@ -19,13 +19,11 @@ func NewFIReader(r io.Reader) *FIReader { } func (fir *FIReader) ReadLine() (line string, err error) { -retry: - line, err = fir.r.ReadString('\n') - if err != nil { - return - } - if len(line) == 1 { - goto retry + for len(line) <= 1 { + line, err = fir.r.ReadString('\n') + if err != nil { + return + } } if strings.HasPrefix(line, "data ") { @@ -92,13 +90,11 @@ func NewCatBlobReader(r io.Reader) *CatBlobReader { } func (cbr *CatBlobReader) ReadLine() (line string, err error) { -retry: - line, err = cbr.r.ReadString('\n') - if err != nil { - return - } - if len(line) == 1 { - goto retry + for len(line) <= 1 { + line, err = cbr.r.ReadString('\n') + if err != nil { + return + } } // get-mark : LF -- cgit v1.2.3-54-g00ecf