Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"crypto/tls"
"math"
"os"
"path/filepath"
"strings"
"time"

"github.com/bmatcuk/doublestar/v4"
"github.com/roadrunner-server/errors"
"github.com/roadrunner-server/pool/pool"
)
Expand Down Expand Up @@ -70,8 +70,8 @@ func (c *Config) InitDefaults() error { //nolint:gocyclo,gocognit
continue
}

if strings.ContainsAny(path, "*?[") {
files, err := filepath.Glob(path)
if strings.ContainsAny(path, "*?[{") {
files, err := doublestar.FilepathGlob(path)
if err != nil {
return errors.E(op, err)
}
Expand Down
23 changes: 23 additions & 0 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,29 @@ func TestInitDefaults(t *testing.T) {
assert.NoError(t, c.InitDefaults())
assert.Equal(t, []string{"parser" + separator + "test.proto"}, c.Proto)

c.Proto = []string{"parser/test_nested/**/*.proto"}
assert.NoError(t, c.InitDefaults())
assert.Equal(t, []string{
"parser" + separator + "test_nested" + separator + "message.proto",
"parser" + separator + "test_nested" + separator + "pong.proto",
"parser" + separator + "test_nested" + separator + "test_import.proto",
"parser" + separator + "test_nested" + separator + "sub" + separator + "deep.proto",
}, c.Proto)

c.Proto = []string{"parser/{message,pong}.proto"}
assert.NoError(t, c.InitDefaults())
assert.Equal(t, []string{
"parser" + separator + "message.proto",
"parser" + separator + "pong.proto",
}, c.Proto)

c.Proto = []string{"parser/{*_import.proto,pong.proto}"}
assert.NoError(t, c.InitDefaults())
assert.Equal(t, []string{
"parser" + separator + "pong.proto",
"parser" + separator + "test_import.proto",
}, c.Proto)

c.Proto = []string{"[[[error"}
assert.Error(t, c.InitDefaults())
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ require (

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bmatcuk/doublestar/v4 v4.10.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
Comment on lines 29 to 31
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github.com/bmatcuk/doublestar/v4 is imported from non-test code (config.go), so it should be a direct dependency in the main require block. Keeping it under the // indirect section can get reverted by go mod tidy and makes the dependency graph harder to reason about.

Copilot uses AI. Check for mistakes.
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/go-logr/logr v1.4.3 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
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/v4 v4.10.0 h1:zU9WiOla1YA122oLM6i4EXvGW62DvKZVxIe6TYWexEs=
github.com/bmatcuk/doublestar/v4 v4.10.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
Expand Down
Loading
Loading