INNER CODE UNIT · Go
marshalAsCSV
kubernetes/k8s.io · infra/aws/aws-costexplorer-export/main.go:156
func marshalAsCSV(input interface{}) string {
o, err := csvutil.Marshal(input)
if err != nil {
fmt.Println("error marshalling CSV:", err)
return ""
}
return string(o)
}
func writeFile(path string, contents string) error {
f, err := os.Create(path)
if err != nil {
return err
}
defer f.Close()
_, err = f.WriteString(contents)
if err != nil {
return err