Standard library / encoding/csv
encoding/csv.Writer.Flush()
Push buffered CSV bytes to the underlying writer. Check Writer.Error because Flush itself has no return value. Expected stdout: 'a\n'.
Formal Syntax & Structure
go syntaxgo
func (w *Writer) Flush()Working Example
Example Snippetgo
package main
import ( "bytes" "encoding/csv" "fmt")
func must(e error) { if e != nil { panic(e) }}
func main() { var b bytes.Buffer w := csv.NewWriter(&b) must(w.Write([]string{"a"})) w.Flush() must(w.Error()) fmt.Print(b.String())}