summaryrefslogtreecommitdiff
path: root/textproto
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-11-16 15:29:06 -0500
committerLuke Shumaker <lukeshu@lukeshu.com>2017-11-16 15:29:06 -0500
commit56b8f0793f036727aeb0a45968c6f69e260775e6 (patch)
tree739d9fa5a5f34874638508b7af7a7ea709f9351d /textproto
parentce0f40c125ff838d332c1974c8e505e4be1e409b (diff)
begone with goto
Diffstat (limited to 'textproto')
-rw-r--r--textproto/io.go24
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