fix csv Flush;

This commit is contained in:
2022-05-02 12:40:38 -04:00
parent d284956268
commit 8637252785
3 changed files with 61 additions and 8 deletions

30
exp/csvw/main.go Normal file
View File

@ -0,0 +1,30 @@
package main
import (
"bytes"
"encoding/csv"
"fmt"
"io"
)
func main() {
fmt.Println("vim-go")
var b bytes.Buffer
writer := csv.NewWriter(&b)
err := writer.Write([]string{
"foo",
"bar",
"blah",
})
if err != nil {
panic(err)
}
writer.Flush()
b.WriteString("Hello World")
content, err := io.ReadAll(&b)
if err != nil {
panic(err)
}
fmt.Printf("%s\n", content)
fmt.Println("bye")
}