mirror of
https://github.com/ddworken/hishtory.git
synced 2025-02-18 03:20:53 +01:00
Swap to using glob to enumerate all golden files, rather than hardcoding them
This commit is contained in:
parent
f4694bdd28
commit
ed22ae6e4f
@ -7,6 +7,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
@ -43,15 +44,15 @@ func checkGoldensUsed() {
|
|||||||
}
|
}
|
||||||
// Read the goldens that were used
|
// Read the goldens that were used
|
||||||
usedGoldens := make([]string, 0)
|
usedGoldens := make([]string, 0)
|
||||||
filenames := []string{
|
filenames, err := filepath.Glob("*/goldens-used.txt")
|
||||||
"goldens-used-macos-14-BASIC/goldens-used.txt", "goldens-used-macos-14-TUI/goldens-used.txt",
|
if err != nil {
|
||||||
"goldens-used-macos-latest-BASIC/goldens-used.txt", "goldens-used-macos-latest-TUI/goldens-used.txt",
|
log.Fatalf("failed to list golden files: %v", err)
|
||||||
"goldens-used-ubuntu-latest-BASIC/goldens-used.txt", "goldens-used-ubuntu-latest-TUI/goldens-used.txt",
|
|
||||||
}
|
}
|
||||||
|
fmt.Printf("Found used goldens in %#v\n", filenames)
|
||||||
for _, filename := range filenames {
|
for _, filename := range filenames {
|
||||||
usedGoldensFile, err := os.Open(filename)
|
usedGoldensFile, err := os.Open(filename)
|
||||||
if err != nil {
|
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()
|
defer usedGoldensFile.Close()
|
||||||
scanner := bufio.NewScanner(usedGoldensFile)
|
scanner := bufio.NewScanner(usedGoldensFile)
|
||||||
|
Loading…
Reference in New Issue
Block a user