Answer prose round 1: loadCallerPath's name and docstring say it loads, and that the caller walks next
This commit is contained in:
@@ -125,7 +125,7 @@ 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, segments, err := f.callerPath(path)
|
||||
path, segments, err := f.loadCallerPath(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
func (f *Generator) Fake(path string) (string, error) {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
path, segments, err := f.callerPath(path)
|
||||
path, segments, err := f.loadCallerPath(path)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
+3
-3
@@ -58,9 +58,9 @@ func unloadedAt(root *folder, segs []string) (unloadedCategory, bool) {
|
||||
return unloadedCategory{dir: segs[:i:i], in: g, name: segs[i]}, true
|
||||
}
|
||||
|
||||
// callerPath is a caller's path without its leading /, and split, with the shipped category
|
||||
// it names or descends into loaded: a walk is a query and loads nothing.
|
||||
func (f *Generator) callerPath(path string) (string, []string, error) {
|
||||
// loadCallerPath strips the / a caller's path may start with, splits the path, and loads the
|
||||
// shipped category it names or descends into. The caller walks it next, and a walk loads nothing.
|
||||
func (f *Generator) loadCallerPath(path string) (string, []string, error) {
|
||||
path, err := grammar.CallerPath(path)
|
||||
if err != nil {
|
||||
return "", nil, fmt.Errorf("fejkdata: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user