lostluck commented on code in PR #21943:
URL: https://github.com/apache/beam/pull/21943#discussion_r902860553
##########
sdks/go/pkg/beam/io/filesystem/memfs/memory.go:
##########
@@ -54,14 +55,18 @@ func (f *fs) List(_ context.Context, glob string)
([]string, error) {
f.mu.Lock()
defer f.mu.Unlock()
- pattern, err := regexp.Compile(glob)
- if err != nil {
- return nil, err
+ globNoScheme := strings.TrimPrefix(glob, "memfs://")
+ if globNoScheme == glob {
+ return nil, fmt.Errorf("invalid pattern %q does not have prefix
memfs://", glob)
}
var ret []string
for k := range f.m {
- if pattern.MatchString(k) {
+ matched, err := path.Match(globNoScheme, strings.TrimPrefix(k,
"memfs://"))
Review Comment:
Please switch this to (path/filepath) filepath.Match instead, for
consistency with the gcs and local implementations. In practice it's always
linux. Please also update the documentation in filesystem.Interface.List to be
explicit as you suggested.
Thank you for the contribution!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]