Drop the unreachable reference-prefix checks

A name starting with ".." also starts with ".", so loadDir's hidden-entry
skip reaches it first and neither isRef branch could ever fire. Removed, and
the comment in named now names the skip that actually holds the invariant it
depends on.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
M
2026-08-31 13:41:46 +02:00
committed by lilleman-tw
parent 25a3077925
commit 2dbc9b1f9f
2 changed files with 2 additions and 8 deletions
-6
View File
@@ -61,9 +61,6 @@ func loadDir(dir string) (*group, error) {
}
full := filepath.Join(dir, e.Name())
if e.IsDir() {
if isRef(e.Name()) {
return nil, fmt.Errorf("%s: folder %q starts with %q, which is reserved for {..path} bindings", full, e.Name(), refPrefix)
}
child, err := loadDir(full)
if err != nil {
return nil, err
@@ -81,9 +78,6 @@ func loadDir(dir string) (*group, error) {
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)
}
if err := checkName(name); err != nil {
return nil, fmt.Errorf("%s: category %w", full, err)
}