type Writer … // NewWriter returns a new [Writer] writing to w. func NewWriter(w *bufio.Writer) *Writer { … } var crnl … var dotcrnl … // PrintfLine writes the formatted output followed by \r\n. func (w *Writer) PrintfLine(format string, args ...any) error { … } // DotWriter returns a writer that can be used to write a dot-encoding to w. // It takes care of inserting leading dots when necessary, // translating line-ending \n into \r\n, and adding the final .\r\n line // when the DotWriter is closed. The caller should close the // DotWriter before the next call to a method on w. // // See the documentation for the [Reader.DotReader] method for details about dot-encoding. func (w *Writer) DotWriter() io.WriteCloser { … } func (w *Writer) closeDot() { … } type dotWriter … const wstateBegin … const wstateBeginLine … const wstateCR … const wstateData … func (d *dotWriter) Write(b []byte) (n int, err error) { … } func (d *dotWriter) Close() error { … }