diff --git a/codegen/codegen.go b/codegen/codegen.go index d3cbb7ac98a..773e3db7cc4 100644 --- a/codegen/codegen.go +++ b/codegen/codegen.go @@ -153,7 +153,7 @@ func (cfg *Config) normalize() error { var sources []*ast.Source for _, filename := range cfg.SchemaFilename { - sources = append(sources, &ast.Source{Name: filename, Input: cfg.SchemaStr[filename]}) + sources = append(sources, &ast.Source{Name: filename, Input: cfg.SchemaStr[filename]}) } var err *gqlerror.Error diff --git a/codegen/codegen_test.go b/codegen/codegen_test.go index 4bf0eb25553..5cbc301d6a7 100644 --- a/codegen/codegen_test.go +++ b/codegen/codegen_test.go @@ -22,10 +22,10 @@ func TestGenerateServer(t *testing.T) { serverFilename := "gen/" + name + "/server/server.go" cfg := Config{ SchemaFilename: SchemaFilenames{"schema.graphql"}, - SchemaStr: map[string]string{"schema.graphql": schema}, - Exec: PackageConfig{Filename: "gen/" + name + "/exec.go"}, - Model: PackageConfig{Filename: "gen/" + name + "/model.go"}, - Resolver: PackageConfig{Filename: "gen/" + name + "/resolver.go", Type: "Resolver"}, + SchemaStr: map[string]string{"schema.graphql": schema}, + Exec: PackageConfig{Filename: "gen/" + name + "/exec.go"}, + Model: PackageConfig{Filename: "gen/" + name + "/model.go"}, + Resolver: PackageConfig{Filename: "gen/" + name + "/resolver.go", Type: "Resolver"}, } _ = syscall.Unlink(cfg.Resolver.Filename) diff --git a/codegen/config_test.go b/codegen/config_test.go index a3133ae6a91..c92c99e928d 100644 --- a/codegen/config_test.go +++ b/codegen/config_test.go @@ -45,7 +45,7 @@ func TestLoadDefaultConfig(t *testing.T) { cfg, err = LoadConfigFromDefaultLocations() require.NoError(t, err) - require.Equal(t, SchemaFilenames{"outer"},cfg.SchemaFilename) + require.Equal(t, SchemaFilenames{"outer"}, cfg.SchemaFilename) }) t.Run("will return error if config doesn't exist", func(t *testing.T) { diff --git a/codegen/input_test.go b/codegen/input_test.go index 6034c5f0ea7..eb9a8116d1c 100644 --- a/codegen/input_test.go +++ b/codegen/input_test.go @@ -36,9 +36,9 @@ func TestTypeInInput(t *testing.T) { func generate(name string, schema string, typemap ...TypeMap) error { cfg := Config{ SchemaFilename: SchemaFilenames{"schema.graphql"}, - SchemaStr: map[string]string{"schema.graphql": schema}, - Exec: PackageConfig{Filename: "gen/" + name + "/exec.go"}, - Model: PackageConfig{Filename: "gen/" + name + "/model.go"}, + SchemaStr: map[string]string{"schema.graphql": schema}, + Exec: PackageConfig{Filename: "gen/" + name + "/exec.go"}, + Model: PackageConfig{Filename: "gen/" + name + "/model.go"}, } if len(typemap) > 0 { diff --git a/codegen/util_test.go b/codegen/util_test.go index be0c4b9fc2a..2a7783d9954 100644 --- a/codegen/util_test.go +++ b/codegen/util_test.go @@ -101,9 +101,9 @@ func parseScope(t *testing.T, input interface{}, packageName string) (*types.Sco func TestEqualFieldName(t *testing.T) { tt := []struct { - Name string - Source string - Target string + Name string + Source string + Target string Expected bool }{ {Name: "words with same case", Source: "test", Target: "test", Expected: true}, @@ -115,7 +115,7 @@ func TestEqualFieldName(t *testing.T) { for _, tc := range tt { t.Run(tc.Name, func(t *testing.T) { - result := equalFieldName(tc.Source, tc.Target) + result := equalFieldName(tc.Source, tc.Target) require.Equal(t, tc.Expected, result) }) }