Skip to content

Commit 34f47b0

Browse files
committed
undecided on how to proceed with file iterations...
Signed-off-by: ed kim <ekim8015@gmail.com>
1 parent b5cfe90 commit 34f47b0

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

command/init.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,11 @@ func (c *Config) RunInit() error {
111111
_ = localstore.InitDB(sqlConf)
112112

113113
// Try to run the filewalk...
114-
114+
handler := filewalk.Handle{}
115115
walker := filewalk.NewWalker(c.location, c.exclude, c.include)
116-
walker.Walker()
116+
array, err := walker.Walker(&handler)
117+
118+
zap.S().Debugf("init method returned %v", array)
117119

118120
return nil
119121

filewalk/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# filewalk
2+
3+
This package needs more thought.
4+
5+
## handler
6+
7+
We need to pass files found by Walker to handler.go, which in term will do the
8+
extra magic for us before (or maybe it does it) we push files to the database.
9+
10+
## walker
11+
12+
Implements the file.Walk method to step through the file system when needed.

filewalk/handler.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package filewalk
2+
3+
// Handler is my best fwiend
4+
type Handler interface {
5+
md5() string
6+
}
7+
8+
// Handle struct...
9+
type Handle struct{}
10+
11+
// NewHandler returns a famous struct
12+
func NewHandler() *Handle {
13+
return &Handle{}
14+
}
15+
16+
func (h *Handle) md5() string {
17+
return ""
18+
}

filewalk/walker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func NewWalker(location string, exclude, include []string) *WalkerConfig {
3030

3131
// Walker will return your files. It's responsible for filtering the files based on
3232
// Include and Exclude.
33-
func (w *WalkerConfig) Walker() ([]string, error) {
33+
func (w *WalkerConfig) Walker(fh Handler) ([]string, error) {
3434
var buff []string
3535
helper := &godirwalk.Options{
3636
Callback: func(osPathname string, de *godirwalk.Dirent) error {

0 commit comments

Comments
 (0)