Answer architecture round 1: read the module path from go.mod, keep the randomness behind State's methods, rename the field drawState and the counter Seq, and file items 108 and 109

This commit is contained in:
2026-10-05 11:52:10 +02:00
committed by Lillem4n
parent ddc3193593
commit 1d0fe9f555
16 changed files with 78 additions and 52 deletions
+15 -2
View File
@@ -4,6 +4,7 @@ import (
"errors"
"go/build"
"io/fs"
"os"
"path/filepath"
"slices"
"strings"
@@ -12,14 +13,26 @@ import (
// TestPackageImports holds each package in the module to the module packages it may import.
func TestPackageImports(t *testing.T) {
const module = "github.com/larvit/fejkdata"
mod, err := os.ReadFile("go.mod")
if err != nil {
t.Fatal(err)
}
module, found := "", false
for _, line := range strings.Split(string(mod), "\n") {
if module, found = strings.CutPrefix(strings.TrimSpace(line), "module "); found {
break
}
}
if !found {
t.Fatal("go.mod names no module")
}
allowed := map[string][]string{
".": {"internal/drawstate"},
"cmd/fejkdata": {"."},
"internal/drawstate": nil,
}
seen := map[string]bool{}
err := filepath.WalkDir(".", func(dir string, d fs.DirEntry, err error) error {
err = filepath.WalkDir(".", func(dir string, d fs.DirEntry, err error) error {
if err != nil || !d.IsDir() {
return err
}