mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-13 15:07:10 +08:00
45
vendor/github.com/tonistiigi/fsutil/diff.go
generated
vendored
Normal file
45
vendor/github.com/tonistiigi/fsutil/diff.go
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
package fsutil
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hash"
|
||||
"os"
|
||||
|
||||
"github.com/tonistiigi/fsutil/types"
|
||||
)
|
||||
|
||||
type walkerFn func(ctx context.Context, pathC chan<- *currentPath) error
|
||||
|
||||
func Changes(ctx context.Context, a, b walkerFn, changeFn ChangeFunc) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type HandleChangeFn func(ChangeKind, string, os.FileInfo, error) error
|
||||
|
||||
type ContentHasher func(*types.Stat) (hash.Hash, error)
|
||||
|
||||
func GetWalkerFn(root string) walkerFn {
|
||||
return func(ctx context.Context, pathC chan<- *currentPath) error {
|
||||
return Walk(ctx, root, nil, func(path string, f os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
p := ¤tPath{
|
||||
path: path,
|
||||
f: f,
|
||||
}
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
case pathC <- p:
|
||||
return nil
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func emptyWalker(ctx context.Context, pathC chan<- *currentPath) error {
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user