Load a caller's path in the one method that splits it, so Fake and FakeRecord walk only what has loaded

This commit is contained in:
2026-10-09 12:37:31 +02:00
committed by Lillem4n
parent c9ad86a2dd
commit 00f31e6f59
4 changed files with 20 additions and 24 deletions
+2 -7
View File
@@ -125,15 +125,10 @@ func literal(c Column, quote func(string) string, nullText string) string {
func (f *Generator) FakeRecord(path string) (*Record, error) {
f.mu.Lock()
defer f.mu.Unlock()
path, err := grammar.CallerPath(path)
path, segments, err := f.callerPath(path)
if err != nil {
return nil, fmt.Errorf("fejkdata: %w", err)
return nil, err
}
segments, err := grammar.SplitPath(path)
if err != nil {
return nil, fmt.Errorf("fejkdata: %w", err)
}
f.loadShippedAt(segments)
_, n, tail, err := resolveCategory(f.root.children, segments)
if err != nil {
return nil, f.noDataNote(fmt.Errorf("fejkdata: %s: %w", path, err))