Standard library / mime/quotedprintable

quotedprintable.Writer.Close()

Flush pending encoding without closing the underlying writer. Inspect the finalization error. Expected stdout: 'a=20\n'.

Formal Syntax & Structure

go syntaxgo
func (w *Writer) Close() error

Return Value

error

Nil on success, otherwise the operation error.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt"  "io"  "mime/quotedprintable")
func main() {  var b bytes.Buffer  w := quotedprintable.NewWriter(&b)  must(io.WriteString(w, "a "))  check(w.Close())  fmt.Println(b.String())}
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