| 367 | } |
| 368 | |
| 369 | func recordUsingGolden(t testing.TB, goldenName string) { |
| 370 | f, err := os.OpenFile("/tmp/goldens-used.txt", |
| 371 | os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o644) |
| 372 | if err != nil { |
| 373 | t.Fatalf("failed to open file to record using golden: %v", err) |
| 374 | } |
| 375 | defer f.Close() |
| 376 | if _, err := f.WriteString(goldenName + "\n"); err != nil { |
| 377 | t.Fatalf("failed to append to file to record using golden: %v", err) |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | func CompareGoldens(t testing.TB, out, goldenName string) { |
| 382 | recordUsingGolden(t, goldenName) |