Standard library / net/textproto

textproto.Reader

Provides line, response, MIME-header and dot-block parsers using R. Bound input and do not share the reader across concurrent operations. Expected stdout: 'hello\n'.

Formal Syntax & Structure

go syntaxgo
type Reader struct {  R *bufio.Reader
}

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)  }}
Go Reference
textproto.Reader — Go Syntax & Examples | ByteMind