Better file closing

This commit is contained in:
2022-05-05 10:45:41 +02:00
parent 0a20be9660
commit 71befefea8

View File

@@ -183,11 +183,14 @@ func Generate(p *compose.Parser, katernayVersion, appName, appVersion, composeFi
default:
fname := filepath.Join(templatesDir, n+"."+kind+".yaml")
fp, _ := os.Create(fname)
fp, err := os.Create(fname)
if err != nil {
log.Fatal(err)
}
defer fp.Close()
enc := yaml.NewEncoder(fp)
enc.SetIndent(2)
enc.Encode(c)
fp.Close()
}
}
}