refactor this part of code for upcoming change

This commit is contained in:
Sridhar Ratnakumar 2014-05-16 18:05:11 -07:00
parent 929590016a
commit 941cc3e301
1 changed files with 21 additions and 24 deletions

11
tail.go
View File

@ -213,9 +213,7 @@ func (tail *Tail) tailFileSync() {
for {
line, err := tail.readLine()
switch err {
case nil:
if true {
if err == nil {
cooloff := !tail.sendLine(line)
if cooloff {
// Wait a second before seeking till the end of
@ -235,9 +233,7 @@ func (tail *Tail) tailFileSync() {
return
}
}
}
case io.EOF:
// XXX: should `line` be returned at this point?
}else if err == io.EOF {
if !tail.Follow {
return
}
@ -251,7 +247,8 @@ func (tail *Tail) tailFileSync() {
}
return
}
default: // non-EOF error
}else {
// non-EOF error
tail.Killf("Error reading %s: %s", tail.Filename, err)
return
}