Skip to content

Commit

Permalink
use doublestar instead of zglob for file globbing
Browse files Browse the repository at this point in the history
  • Loading branch information
leonid-shevtsov committed May 15, 2020
1 parent 4d90ebc commit 12832d2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/leonid-shevtsov/split_tests

go 1.14

require github.com/mattn/go-zglob v0.0.0-20170124115757-95345c4e1c0e
require github.com/bmatcuk/doublestar v1.3.0
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github.com/mattn/go-zglob v0.0.0-20170124115757-95345c4e1c0e h1:MjZj0KCx7aFNToMEqvMJB0IE+PpRi/goV1RC4NPfy4A=
github.com/mattn/go-zglob v0.0.0-20170124115757-95345c4e1c0e/go.mod h1:9fxibJccNxU2cnpIKLRRFA7zX7qhkJIQWBb449FYHOo=
github.com/bmatcuk/doublestar v1.3.0 h1:1jLE2y0VpSrOn/QR9G4f2RmrCtkM3AuATcWradjHUvM=
github.com/bmatcuk/doublestar v1.3.0/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE=
10 changes: 8 additions & 2 deletions split_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strconv"
"strings"

zglob "github.com/mattn/go-zglob"
"github.com/bmatcuk/doublestar"
)

var useCircleCI bool
Expand Down Expand Up @@ -148,7 +148,13 @@ func parseFlags() {
func main() {
parseFlags()

currentFiles, _ := zglob.Glob(testFilePattern)
// We are not using filepath.Glob,
// because it doesn't support '**' (to match all files in all nested directories)
currentFiles, err := doublestar.Glob(testFilePattern)
if err != nil {
printMsg("failed to enumerate current file set: %v", err)
os.Exit(1)
}
currentFileSet := make(map[string]bool)
for _, file := range currentFiles {
currentFileSet[file] = true
Expand Down

0 comments on commit 12832d2

Please sign in to comment.