MCPcopy Create free account
hub / github.com/nsf/gocode / readdir_lstat

Function readdir_lstat

utils.go:17–38  ·  view source on GitHub ↗

our own readdir, which skips the files it cannot lstat

(name string)

Source from the content-addressed store, hash-verified

15
16// our own readdir, which skips the files it cannot lstat
17func readdir_lstat(name string) ([]os.FileInfo, error) {
18 f, err := os.Open(name)
19 if err != nil {
20 return nil, err
21 }
22 defer f.Close()
23
24 names, err := f.Readdirnames(-1)
25 if err != nil {
26 return nil, err
27 }
28
29 out := make([]os.FileInfo, 0, len(names))
30 for _, lname := range names {
31 s, err := os.Lstat(filepath.Join(name, lname))
32 if err != nil {
33 continue
34 }
35 out = append(out, s)
36 }
37 return out, nil
38}
39
40// our other readdir function, only opens and reads
41func readdir(dirname string) []os.FileInfo {

Callers 2

autobuildFunction · 0.85
find_other_package_filesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected