Standard library / net/textproto

textproto.Reader.ReadDotLines()

Read a dot-framed block as a slice of decoded lines with line endings removed. Expected stdout: '[.hello world]\n'.

Formal Syntax & Structure

go syntaxgo
func (r *Reader) ReadDotLines() ([]string, error)

Return Value

([]string, error)

Decoded lines 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\nworld\r\n.\r\n")))  fmt.Println(must(r.ReadDotLines()))}
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