diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-11-16 15:29:06 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-11-16 15:29:06 -0500 |
commit | 56b8f0793f036727aeb0a45968c6f69e260775e6 (patch) | |
tree | 739d9fa5a5f34874638508b7af7a7ea709f9351d /textproto | |
parent | ce0f40c125ff838d332c1974c8e505e4be1e409b (diff) |
begone with goto
Diffstat (limited to 'textproto')
-rw-r--r-- | textproto/io.go | 24 |
1 files 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 : <sha1> LF |