Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cbelsole committed May 18, 2019
1 parent e9389ef commit e32c82b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 4 additions & 1 deletion codegen/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ func LoadConfig(filename string) (*Config, error) {

// make sure paths match files
// <root>?.*<filename|.+>\.<ext>
fileRegex := regexp.MustCompile(pathParts[0] + "?.*" + strings.Replace(strings.Replace(pathParts[1], ".", "\\.", -1), "*", ".+", -1))
fileRegex := regexp.MustCompile(
pathParts[0] +
"?.*" +
strings.Replace(strings.Replace(pathParts[1], ".", "\\.", -1), "*", ".+", -1))
if fileRegex.MatchString(path) {
matches = append(matches, path)
}
Expand Down
5 changes: 2 additions & 3 deletions codegen/config/config_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package config

import (
"fmt"
"os"
"path/filepath"
"testing"
Expand All @@ -28,8 +27,8 @@ func TestLoadConfig(t *testing.T) {

t.Run("globbed filenames", func(t *testing.T) {
c, err := LoadConfig("testdata/cfg/glob.yml")
require.NoError(t, err, "")
fmt.Printf("%+v\n", c)
require.NoError(t, err)

require.Equal(t, c.SchemaFilename[0], "testdata/cfg/glob/bar/bar with spaces.graphql")
require.Equal(t, c.SchemaFilename[1], "testdata/cfg/glob/foo/foo.graphql")
})
Expand Down

0 comments on commit e32c82b

Please sign in to comment.