From ed22ae6e4f37a83b96e931096ce0998a269390ed Mon Sep 17 00:00:00 2001 From: David Dworken Date: Sat, 10 Feb 2024 10:07:37 -0800 Subject: [PATCH] Swap to using glob to enumerate all golden files, rather than hardcoding them --- client/posttest/main.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/client/posttest/main.go b/client/posttest/main.go index 63e8930..48c6502 100644 --- a/client/posttest/main.go +++ b/client/posttest/main.go @@ -7,6 +7,7 @@ import ( "log" "os" "path" + "path/filepath" "runtime" "slices" "strings" @@ -43,15 +44,15 @@ func checkGoldensUsed() { } // Read the goldens that were used usedGoldens := make([]string, 0) - filenames := []string{ - "goldens-used-macos-14-BASIC/goldens-used.txt", "goldens-used-macos-14-TUI/goldens-used.txt", - "goldens-used-macos-latest-BASIC/goldens-used.txt", "goldens-used-macos-latest-TUI/goldens-used.txt", - "goldens-used-ubuntu-latest-BASIC/goldens-used.txt", "goldens-used-ubuntu-latest-TUI/goldens-used.txt", + filenames, err := filepath.Glob("*/goldens-used.txt") + if err != nil { + log.Fatalf("failed to list golden files: %v", err) } + fmt.Printf("Found used goldens in %#v\n", filenames) for _, filename := range filenames { usedGoldensFile, err := os.Open(filename) if err != nil { - log.Fatalf("failed to open /tmp/goldens-used.txt: %v", err) + log.Fatalf("failed to open %s: %v", filename, err) } defer usedGoldensFile.Close() scanner := bufio.NewScanner(usedGoldensFile)