mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-20 11:57:50 +02:00
Move log.Fatalf call to end so that we log all unused goldens before failing the program
This commit is contained in:
parent
db19d8ebf1
commit
20fce0ef02
@ -61,6 +61,7 @@ func checkGoldensUsed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// And check for mismatches
|
// And check for mismatches
|
||||||
|
var unusedGoldenErr error = nil
|
||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
goldenName := path.Base(f.Name())
|
goldenName := path.Base(f.Name())
|
||||||
if !slices.Contains(usedGoldens, goldenName) {
|
if !slices.Contains(usedGoldens, goldenName) {
|
||||||
@ -73,11 +74,13 @@ func checkGoldensUsed() {
|
|||||||
// It is for another OS
|
// It is for another OS
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
err = fmt.Errorf("golden file %v was never used", goldenName)
|
unusedGoldenErr = fmt.Errorf("golden file %v was never used", goldenName)
|
||||||
fmt.Println(err)
|
fmt.Println(unusedGoldenErr)
|
||||||
log.Fatalf("%v", err)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if unusedGoldenErr != nil {
|
||||||
|
log.Fatalf("%v", unusedGoldenErr)
|
||||||
|
}
|
||||||
|
|
||||||
// And print out anything that is in UNUSED_GOLDENS that was actually used, so we
|
// And print out anything that is in UNUSED_GOLDENS that was actually used, so we
|
||||||
// can manually trim UNUSED_GOLDENS
|
// can manually trim UNUSED_GOLDENS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user