diff --git a/mfer/manifest.go b/mfer/manifest.go index 130b611..6c35956 100644 --- a/mfer/manifest.go +++ b/mfer/manifest.go @@ -192,12 +192,19 @@ func (m *manifest) addFile(p string, fi fs.FileInfo, sfsIndex int) error { } func (m *manifest) Scan() error { - // FIXME scan and whatever function does the hashing should take ctx for idx, sfs := range m.sourceFS { if sfs == nil { return errors.New("invalid source fs") } e := afero.Walk(sfs, "/", func(p string, info fs.FileInfo, err error) error { + // Check for context cancellation + if m.ctx != nil { + select { + case <-m.ctx.Done(): + return m.ctx.Err() + default: + } + } return m.addFile(p, info, idx) }) if e != nil {