github.com/oarkflow/log@v1.0.78/fqdn/util.go (about)

     1  package fqdn
     2  
     3  import (
     4  	"bufio"
     5  	"io"
     6  )
     7  
     8  // Read lines from r. It strips the line terminators and handles case when last
     9  // line is not terminated.
    10  func readline(r *bufio.Reader) (string, error) {
    11  	s, e := r.ReadString('\n')
    12  
    13  	if e == io.EOF && len(s) != 0 {
    14  		e = nil
    15  	}
    16  
    17  	s = chomp(s)
    18  
    19  	return s, e
    20  }