tss/exp/csvw/main.go

31 lines
408 B
Go
Raw Normal View History

2022-05-02 12:40:38 -04:00
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")
}