Standard library / net/textproto
textproto.Reader.ReadLine()
Read one line without its CRLF or LF ending. Expected stdout: 'hello\n'.
Formal Syntax & Structure
go syntaxgo
func (r *Reader) ReadLine() (string, error)Return Value
(string, error)
Line without line ending and error.
Working Example
Example Snippetgo
package main
import ( "bufio" "fmt" "net/textproto" "strings")
func main() { r := textproto.NewReader(bufio.NewReader(strings.NewReader("hello\r\n"))) fmt.Println(must(r.ReadLine()))}
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}