Reserve the reference prefix in authored names, and report one compile error

This commit is contained in:
Mikael Göransson
2026-08-27 23:46:44 +02:00
committed by lilleman-tw
parent af0c99809c
commit e14f3a4145
3 changed files with 17 additions and 5 deletions
+5 -1
View File
@@ -67,6 +67,10 @@ func loadDir(dir string) (*group, error) {
if !strings.HasSuffix(e.Name(), ".json") {
continue
}
name := strings.TrimSuffix(e.Name(), ".json")
if isRef(name) {
return nil, fmt.Errorf("%s: category %q starts with %q, which is reserved for {..path} bindings", full, name, refPrefix)
}
b, err := os.ReadFile(full)
if err != nil {
return nil, err
@@ -79,7 +83,7 @@ func loadDir(dir string) (*group, error) {
if err != nil {
return nil, fmt.Errorf("%s: %w", full, err)
}
g.children[strings.TrimSuffix(e.Name(), ".json")] = n
g.children[name] = n
}
return g, nil
}