github.com/tobgu/qframe@v0.4.0/internal/fastcsv/testdata/addquotes.go (about)

     1  package main
     2  
     3  import (
     4  	"encoding/csv"
     5  	"fmt"
     6  	"io"
     7  	"os"
     8  	"strings"
     9  )
    10  
    11  func main() {
    12  	r := csv.NewReader(os.Stdin)
    13  	for {
    14  		row, err := r.Read()
    15  		if err != nil {
    16  			if err != io.EOF {
    17  				panic(err)
    18  			}
    19  			break
    20  		}
    21  		for i := range row {
    22  			row[i] = fmt.Sprintf("\"%s\"", row[i])
    23  		}
    24  		fmt.Fprintln(os.Stdout, strings.Join(row, ","))
    25  	}
    26  }