@@ -21,6 +21,7 @@ import (
2121 "io"
2222 "os"
2323 "path/filepath"
24+ "slices"
2425 "strconv"
2526 "strings"
2627
@@ -403,14 +404,13 @@ func (o *ProjectOptions) GetWorkingDir() (string, error) {
403404}
404405
405406// ReadConfigFiles reads ConfigFiles and populates the content field
406- func (o * ProjectOptions ) ReadConfigFiles (ctx context.Context , workingDir string , options * ProjectOptions ) (* types.ConfigDetails , error ) {
407- config , err := loader .LoadConfigFiles (ctx , options .ConfigPaths , workingDir , options .loadOptions ... )
407+ func (o * ProjectOptions ) ReadConfigFiles (ctx context.Context , workingDir string ) (* types.ConfigDetails , error ) {
408+ config , err := loader .LoadConfigFiles (ctx , o .ConfigPaths , workingDir , o .loadOptions ... )
408409 if err != nil {
409410 return nil , err
410411 }
411- configs := make ([][]byte , len (config .ConfigFiles ))
412-
413- for i , c := range config .ConfigFiles {
412+ configs := make ([]types.ConfigFile , 0 , len (config .ConfigFiles ))
413+ for _ , c := range config .ConfigFiles {
414414 var err error
415415 var b []byte
416416 if c .IsStdin () {
@@ -423,16 +423,29 @@ func (o *ProjectOptions) ReadConfigFiles(ctx context.Context, workingDir string,
423423 if err != nil {
424424 return nil , err
425425 }
426- b , err = os .ReadFile (f )
426+
427+ matches , err := filepath .Glob (f )
427428 if err != nil {
428429 return nil , err
429430 }
431+
432+ slices .Sort (matches )
433+
434+ for _ , match := range matches {
435+ b , err = os .ReadFile (match )
436+ if err != nil {
437+ return nil , err
438+ }
439+
440+ configs = append (configs , types.ConfigFile {
441+ Filename : match ,
442+ Content : b ,
443+ Config : nil ,
444+ })
445+ }
430446 }
431- configs [i ] = b
432- }
433- for i , c := range configs {
434- config .ConfigFiles [i ].Content = c
435447 }
448+ config .ConfigFiles = configs
436449 return config , nil
437450}
438451
@@ -476,7 +489,7 @@ func (o *ProjectOptions) prepare(ctx context.Context) (*types.ConfigDetails, err
476489 return & types.ConfigDetails {}, err
477490 }
478491
479- configDetails , err := o .ReadConfigFiles (ctx , defaultDir , o )
492+ configDetails , err := o .ReadConfigFiles (ctx , defaultDir )
480493 if err != nil {
481494 return configDetails , err
482495 }
0 commit comments