From 74e17d03abd6801eeffbf210ef2f32fc914a7105 Mon Sep 17 00:00:00 2001 From: Benoit Sigoure Date: Tue, 13 Dec 2016 17:05:48 -0800 Subject: [PATCH] tail: Minor code cleanup. Change-Id: Ib33db2c41cfd6117a9e9bfe64eab002f2b87331d --- tail.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tail.go b/tail.go index 2d252d6..c99cdaa 100644 --- a/tail.go +++ b/tail.go @@ -22,7 +22,7 @@ import ( ) var ( - ErrStop = fmt.Errorf("tail should now stop") + ErrStop = errors.New("tail should now stop") ) type Line struct { @@ -250,7 +250,7 @@ func (tail *Tail) tailFileSync() { tail.openReader() - var offset int64 = 0 + var offset int64 var err error // Read line by line. @@ -273,10 +273,9 @@ func (tail *Tail) tailFileSync() { if cooloff { // Wait a second before seeking till the end of // file when rate limit is reached. - msg := fmt.Sprintf( - "Too much log activity; waiting a second " + - "before resuming tailing") - tail.Lines <- &Line{msg, time.Now(), fmt.Errorf(msg)} + msg := ("Too much log activity; waiting a second " + + "before resuming tailing") + tail.Lines <- &Line{msg, time.Now(), errors.New(msg)} select { case <-time.After(time.Second): case <-tail.Dying():