MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / walkDir

Function walkDir

tools/mage/sql.go:61–87  ·  view source on GitHub ↗
(root string, apply func(path string, filename string) error)

Source from the content-addressed store, hash-verified

59}
60
61func walkDir(root string, apply func(path string, filename string) error) error {
62 files, err := os.ReadDir(root)
63 if err != nil && !errors.Is(err, fs.ErrPermission) {
64 return err
65 }
66
67 if errors.Is(err, fs.ErrPermission) {
68 if mg.Verbose() {
69 log.Printf("skipping '%s' file due to permission denied\n", root)
70 }
71 return nil
72 }
73
74 for _, file := range files {
75 if file.IsDir() {
76 err = walkDir(root+"/"+file.Name(), apply)
77 if err != nil {
78 return err
79 }
80 }
81 err = apply(root, file.Name())
82 if err != nil {
83 return err
84 }
85 }
86 return nil
87}
88
89func fixBunSplit(path string, filename string) error {
90 if !strings.HasSuffix(filename, ".sql") {

Callers 1

FmtMethod · 0.85

Calls 3

NameMethod · 0.65
IsMethod · 0.45
PrintfMethod · 0.45

Tested by

no test coverage detected