Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Jun 25, 2024
1 parent ac73db1 commit 71b39fa
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions go/runfiles/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,13 @@ func (m *manifest) open(name string) (fs.File, error) {
if err == ErrEmpty {
return emptyFile(name), nil
} else if err == nil {
// name refers to an actual file or dir listed in the manifest.
return os.Open(r)
} else if err != os.ErrNotExist {
return nil, err
}
// err == os.ErrNotExist, but name may still refer to a directory that
// is a prefix of some manifest entry. We fall back to a trie lookup.
}

// At this point the file is not directly listed in the manifest (or
Expand Down Expand Up @@ -156,7 +161,7 @@ func (m *manifest) open(name string) (fs.File, error) {
}
}

var entries []manifestDirEntry
entries := make([]manifestDirEntry, 0, len(dir))
for e := range dir {
entries = append(entries, manifestDirEntry{e, m.index[path.Join(name, e)]})
}
Expand All @@ -166,9 +171,6 @@ func (m *manifest) open(name string) (fs.File, error) {
return &manifestReadDirFile{dirFile(path.Base(name)), entries}, nil
}

func (m *manifest) initTrie() {
}

type manifestDirEntry struct {
name string
path string
Expand All @@ -189,7 +191,7 @@ func (m *manifestReadDirFile) ReadDir(n int) ([]fs.DirEntry, error) {
entries := m.entries[:n]
m.entries = m.entries[n:]

var dirEntries []fs.DirEntry
dirEntries := make([]fs.DirEntry, 0, len(entries))
for _, e := range entries {
var info fs.FileInfo
if e.path == "" {
Expand Down

0 comments on commit 71b39fa

Please sign in to comment.