Support ** for LargeFiles patterns.

This is done by simply changing from filepath.Match to
doublestar.PathMatch. A few minor tests are included.

The only syntax change is that ** now matches any number of directories,
so "**/*.lock" will match a file with a "lock" extension anywhere in the
path. Since "**" had no special meaning before, this change should not
cause any surprising changes.

Change-Id: Ifbbc8227fa235372521cfbe517ce338920091eef
diff --git a/build/builder.go b/build/builder.go
index d6f3edc..5461828 100644
--- a/build/builder.go
+++ b/build/builder.go
@@ -35,6 +35,7 @@
 	"strings"
 	"sync"
 
+	"github.com/bmatcuk/doublestar"
 	"github.com/google/zoekt"
 	"github.com/google/zoekt/ctags"
 )
@@ -79,9 +80,10 @@
 	// Write memory profiles to this file.
 	MemProfile string
 
-	// LargeFiles is a slice of glob patterns where matching file
-	// paths should be indexed regardless of their size. The pattern syntax
-	// can be found here: https://golang.org/pkg/path/filepath/#Match.
+	// LargeFiles is a slice of glob patterns, including ** for any number
+	// of directories, where matching file paths should be indexed
+	// regardless of their size. The full pattern syntax is here:
+	// https://github.com/bmatcuk/doublestar/tree/v1#patterns.
 	LargeFiles []string
 }
 
@@ -244,7 +246,7 @@
 func (o *Options) IgnoreSizeMax(name string) bool {
 	for _, pattern := range o.LargeFiles {
 		pattern = strings.TrimSpace(pattern)
-		m, _ := filepath.Match(pattern, name)
+		m, _ := doublestar.PathMatch(pattern, name)
 		if m {
 			return true
 		}
diff --git a/go.mod b/go.mod
index c666b79..90ae146 100644
--- a/go.mod
+++ b/go.mod
@@ -4,6 +4,7 @@
 
 require (
 	github.com/andygrunwald/go-gerrit v0.0.0-20191101112536-3f5e365ccf57
+	github.com/bmatcuk/doublestar v1.3.4
 	github.com/fsnotify/fsnotify v1.4.7
 	github.com/gfleury/go-bitbucket-v1 v0.0.0-20200104105711-ddbafbb02522
 	github.com/go-git/go-git/v5 v5.0.0
diff --git a/go.sum b/go.sum
index 241dc8a..4b1a482 100644
--- a/go.sum
+++ b/go.sum
@@ -16,6 +16,8 @@
 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
 github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
 github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
+github.com/bmatcuk/doublestar v1.3.4 h1:gPypJ5xD31uhX6Tf54sDPUOBXTqKH4c9aPY66CyQrS0=
+github.com/bmatcuk/doublestar v1.3.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE=
 github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
 github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
 github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=