Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: handle double star (#17797)

rebelice4883d8a77d3b
diff --git a/action/command/file.go b/action/command/file.go
index 172be394d6..794b9d08e5 100644
--- a/action/command/file.go
+++ b/action/command/file.go
@@ -9,6 +9,7 @@ import (
"slices"
"strings"
+ "github.com/bmatcuk/doublestar/v4"
"github.com/pkg/errors"
"github.com/bytebase/bytebase/action/world"
@@ -19,7 +20,8 @@ const versionFormat = "20060102.150405"
// getReleaseFiles returns the release files and the digest of the release.
func getReleaseFiles(w *world.World) ([]*v1pb.Release_File, string, error) {
- matches, err := filepath.Glob(w.FilePattern)
+ // Use doublestar for recursive glob support (**/*.sql)
+ matches, err := doublestar.FilepathGlob(w.FilePattern)
if err != nil {
return nil, "", err
}
diff --git a/go.mod b/go.mod
index 8de32c55ef..d741162897 100644
--- a/go.mod
+++ b/go.mod
@@ -28,6 +28,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.39.6
github.com/beltran/gohive v1.8.1
github.com/blang/semver/v4 v4.0.0
+ github.com/bmatcuk/doublestar/v4 v4.9.1
github.com/bytebase/cosmosdb-parser v0.0.0-20250317064006-c1dcb3ed4fa4
github.com/bytebase/doris-parser v0.0.0-20251015064614-4677a2b41c32
github.com/bytebase/google-sql-parser v0.0.0-20250116032737-689a327f9465
diff --git a/go.sum b/go.sum
index 73cb37c1ac..88eeb389d5 100644
--- a/go.sum
+++ b/go.sum
@@ -788,6 +788,8 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s=
github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs=
+github.com/bmatcuk/doublestar/v4 v4.9.1 h1:X8jg9rRZmJd4yRy7ZeNDRnM+T3ZfHv15JiBJ/avrEXE=
+github.com/bmatcuk/doublestar/v4 v4.9.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=