refactor: remove empty results.golden.json files

main
sundowndev 2021-07-21 16:08:27 +02:00
parent 25d7d4a647
commit 2344bc3335
88 changed files with 5 additions and 87 deletions

View File

@ -1 +0,0 @@
[]

View File

@ -23,7 +23,7 @@ var Update = flag.String("update", "", "name of test to update")
func ReadFile(p string, name string) []byte {
p = path.Join(GoldenFilePath, p)
_, err := os.Stat(p)
_, err := os.Stat(path.Join(p, ResultsFilename))
if os.IsNotExist(err) && name == ResultsFilename {
return []byte("[]")
}
@ -50,6 +50,10 @@ func WriteFile(p string, content []byte, name string) {
logrus.Error(err)
}
if name == ResultsFilename && string(output) == "[]" {
return
}
if err := ioutil.WriteFile(fmt.Sprintf("%s%c%s", p, os.PathSeparator, sanitizeName(name)), output, os.ModePerm); err != nil {
panic(err)
}