mirror of
https://github.com/numtide/treefmt.git
synced 2024-08-17 04:40:27 +03:00
23 lines
342 B
Go
23 lines
342 B
Go
|
package walk
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"path/filepath"
|
||
|
)
|
||
|
|
||
|
type filesystem struct {
|
||
|
root string
|
||
|
}
|
||
|
|
||
|
func (f filesystem) Root() string {
|
||
|
return f.root
|
||
|
}
|
||
|
|
||
|
func (f filesystem) Walk(_ context.Context, fn filepath.WalkFunc) error {
|
||
|
return filepath.Walk(f.root, fn)
|
||
|
}
|
||
|
|
||
|
func NewFilesystem(root string) (Walker, error) {
|
||
|
return filesystem{root}, nil
|
||
|
}
|