()
| 208 | } |
| 209 | |
| 210 | func (tail *Tail) readLine() (string, error) { |
| 211 | tail.lk.Lock() |
| 212 | line, err := tail.reader.ReadString('\n') |
| 213 | tail.lk.Unlock() |
| 214 | if err != nil { |
| 215 | // Note ReadString "returns the data read before the error" in |
| 216 | // case of an error, including EOF, so we return it as is. The |
| 217 | // caller is expected to process it if err is EOF. |
| 218 | return line, err |
| 219 | } |
| 220 | |
| 221 | line = strings.TrimRight(line, "\n") |
| 222 | |
| 223 | return line, err |
| 224 | } |
| 225 | |
| 226 | func (tail *Tail) tailFileSync() { |
| 227 | defer tail.Done() |