Give dir, path, structs and r one meaning each, and name the table option indexes keyIndex through parentIndex

This commit is contained in:
2026-09-25 19:16:57 +02:00
committed by Lillem4n
parent d6ac8ed9fd
commit c55c75a29e
8 changed files with 69 additions and 69 deletions
+10 -10
View File
@@ -13,11 +13,11 @@ import (
// label prefixes file names in errors; onDisk marks path as a directory that must
// exist.
type dataSource struct {
fsys fs.FS
label string
onDisk bool
path string
dir string
fsys fs.FS
label string
onDisk bool
diskPath string
baseDir string
}
func (s dataSource) labelled(p string) string {
@@ -38,18 +38,18 @@ func loadData(sources []dataSource) (map[string]node, error) {
root := map[string]node{}
for _, src := range sources {
if src.onDisk {
if src.path == "" {
if src.diskPath == "" {
return nil, fmt.Errorf("a data path is empty")
}
info, err := os.Stat(src.path)
info, err := os.Stat(src.diskPath)
if err != nil {
return nil, fmt.Errorf("data path %s: %w", src.path, err)
return nil, fmt.Errorf("data path %s: %w", src.diskPath, err)
}
if !info.IsDir() {
return nil, fmt.Errorf("%s is not a directory", src.path)
return nil, fmt.Errorf("%s is not a directory", src.diskPath)
}
}
dir := src.dir
dir := src.baseDir
if dir == "" {
dir = "."
}