Files
docker-cli/vendor/github.com/tonistiigi/fsutil/diff.go
Sebastiaan van Stijn 74d93d1fa2 vendor: github.com/tonistiigi/fsutil 0834f99b7b85462efb69b4f571a4fa3ca7da5ac9
full diff: ae3a8d7530...0834f99b7b

- walker: fix notadir error
- improving error returns
    - more typed errors
    - remove extra verbosity (eg. PathError already contains action and path)
    - ensure stack traces are added to errors
- various testing and linting fixes
- copy: use Clonefileat from golang.org/x/sys/unix on macOS
- go.mod: update opencontainers/go-digest v1.0.0
- github: test go1.15

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-12-02 21:01:12 +00:00

52 lines
1.0 KiB
Go

package fsutil
import (
"context"
"hash"
"os"
"github.com/pkg/errors"
"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 errors.Wrap(Walk(ctx, root, nil, func(path string, f os.FileInfo, err error) error {
if err != nil {
return err
}
stat, ok := f.Sys().(*types.Stat)
if !ok {
return errors.Errorf("%T invalid file without stat information", f.Sys())
}
p := &currentPath{
path: path,
stat: stat,
}
select {
case <-ctx.Done():
return ctx.Err()
case pathC <- p:
return nil
}
}), "failed to walk")
}
}
func emptyWalker(ctx context.Context, pathC chan<- *currentPath) error {
return nil
}