| 1 | package fsutilscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.21 context/" |
| 5 | "hashscip-go gomod github.com/golang/go/src go1.21 hash/" |
| 6 | "osscip-go gomod github.com/golang/go/src go1.21 os/" |
| 7 | |
| 8 | "github.com/pkg/errorsscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/" |
| 9 | "github.com/tonistiigi/fsutil/typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/" |
| 10 | ) |
| 11 | |
| 12 | type walkerFnscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/walkerFn# func(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, pathC chan<- *currentPathscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/currentPath#) error |
| 13 | |
| 14 | func Changesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Changes().(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, a, b walkerFnscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/walkerFn#, changeFn ChangeFuncscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ChangeFunc#) error { |
| 15 | return nil |
| 16 | } |
| 17 | |
| 18 | type HandleChangeFnscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/HandleChangeFn# func(ChangeKindscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ChangeKind#, string, osscip-go gomod github.com/golang/go/src go1.21 os/.FileInfoscip-go gomod github.com/golang/go/src go1.21 os/FileInfo#, error) error |
| 19 | |
| 20 | type ContentHasherscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/ContentHasher# func(*typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#) (hashscip-go gomod github.com/golang/go/src go1.21 hash/.Hashscip-go gomod github.com/golang/go/src go1.21 hash/Hash#, error) |
| 21 | |
| 22 | func getWalkerFnscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/getWalkerFn().(root string) walkerFnscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/walkerFn# { |
| 23 | return func(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, pathC chan<- *currentPathscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/currentPath#) error { |
| 24 | return errorsscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/.Wrapscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/Wrap().(Walkscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/Walk().(ctx, root, nil, func(path string, f osscip-go gomod github.com/golang/go/src go1.21 os/.FileInfoscip-go gomod github.com/golang/go/src go1.21 os/FileInfo#, err error) error { |
| 25 | if err != nil { |
| 26 | return err |
| 27 | } |
| 28 | |
| 29 | stat, ok := f.Sysscip-go gomod github.com/golang/go/src go1.21 `io/fs`/FileInfo#Sys().().(*typesscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/.Statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil/types`/Stat#) |
| 30 | if !ok { |
| 31 | return errorsscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/.Errorfscip-go gomod github.com/pkg/errors v0.9.1 `github.com/pkg/errors`/Errorf().("%T invalid file without stat information", f.Sysscip-go gomod github.com/golang/go/src go1.21 `io/fs`/FileInfo#Sys().()) |
| 32 | } |
| 33 | |
| 34 | p := ¤tPathscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/currentPath#{ |
| 35 | pathscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/currentPath#path.: path, |
| 36 | statscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/currentPath#stat.: stat, |
| 37 | } |
| 38 | |
| 39 | select { |
| 40 | case <-ctx.Donescip-go gomod github.com/golang/go/src go1.21 context/Context#Done().(): |
| 41 | return ctx.Errscip-go gomod github.com/golang/go/src go1.21 context/Context#Err().() |
| 42 | case pathC <- p: |
| 43 | return nil |
| 44 | } |
| 45 | }), "failed to walk") |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | func emptyWalkerscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/emptyWalker().(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, pathC chan<- *currentPathscip-go gomod github.com/tonistiigi/fsutil . `github.com/tonistiigi/fsutil`/currentPath#) error { |
| 50 | return nil |
| 51 | } |