hpcloud / tail

Go package for reading from continously updated files (tail -f)
MIT License
2.71k stars 503 forks source link

Seek by line #106

Closed StoicPerlman closed 7 years ago

StoicPerlman commented 7 years ago

This is a a rough draft for issue #83 seek by line. I am pretty new to Go (started learning 2 weeks ago) so there are probably a lot of issues with Go style. I also didn't try too hard to match project style on this draft. Any feedback will be in PR update.

No tests yet. I had some issues running existing tests kept getting error ./tail.go:201: cannot use &tail.Tomb (type *"gopkg.in/tomb.v1".Tomb) as type *"github.com/hpcloud/tail/vendor/gopkg.in/tomb.v1".Tomb in argument to tail.watcher.BlockUntilExists

I won't have time to pick this up again for another week or two at which point I will figure how how to do Go testing. I just wanted to get this out there to get your feedback in the meantime.

tail.SeekLine(0,0) -> beginning of first line tail.SeekLine(1,0) -> beginning of second line tail.SeekLine(0,1) -> beginning of current line tail.SeekLine(1,1) -> beginning of next line tail.SeekLine(-1,1) -> beginning of previous line tail.SeekLine(0,2) -> beginning of last line tail.SeekLine(1,2) -> EOF

StoicPerlman commented 7 years ago

moving line seeker to its own package. will reopen soon.