Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 55ed05c

Browse files
committedSep 13, 2022
pkg/tool/file: Replace filepath.Glob with doublestar.FilepathGlob
The Go stdlib implements Glob with Match as its base and does not support the double star syntax. To allow recursive lists via file.Glob it should be supported. Signed-off-by: Fionera <[email protected]>
1 parent 9e9786e commit 55ed05c

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed
 

‎go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module cuelang.org/go
33
go 1.17
44

55
require (
6+
github.com/bmatcuk/doublestar/v4 v4.2.0
67
github.com/cockroachdb/apd/v2 v2.0.2
78
github.com/emicklei/proto v1.10.0
89
github.com/google/go-cmp v0.5.8

‎go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
github.com/bmatcuk/doublestar/v4 v4.2.0 h1:Qu+u9wR3Vd89LnlLMHvnZ5coJMWKQamqdz9/p5GNthA=
2+
github.com/bmatcuk/doublestar/v4 v4.2.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
13
github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E=
24
github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw=
35
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=

‎pkg/tool/file/file.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import (
2525
"cuelang.org/go/cue"
2626
"cuelang.org/go/cue/errors"
2727
"cuelang.org/go/internal/task"
28+
29+
"github.com/bmatcuk/doublestar/v4"
2830
)
2931

3032
func init() {
@@ -114,7 +116,8 @@ func (c *cmdGlob) Run(ctx *task.Context) (res interface{}, err error) {
114116
if ctx.Err != nil {
115117
return nil, ctx.Err
116118
}
117-
m, err := filepath.Glob(glob)
119+
120+
m, err := doublestar.FilepathGlob(glob)
118121
for i, s := range m {
119122
m[i] = filepath.ToSlash(s)
120123
}

0 commit comments

Comments
 (0)
Please sign in to comment.