Skip to content

Commit

Permalink
Merge pull request 99designs#1456 from skaji/issue-1455
Browse files Browse the repository at this point in the history
Fix data race (issue 99designs#1455)

(cherry picked from commit 058a365)
  • Loading branch information
lwc authored and benjaminjkraft committed Jul 26, 2021
1 parent f7488cc commit 4beef02
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 18 deletions.
5 changes: 4 additions & 1 deletion codegen/input.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
{{- if not .HasUnmarshal }}
func (ec *executionContext) unmarshalInput{{ .Name }}(ctx context.Context, obj interface{}) ({{.Type | ref}}, error) {
var it {{.Type | ref}}
var asMap = obj.(map[string]interface{})
asMap := map[string]interface{}{}
for k, v := range obj.(map[string]interface{}) {
asMap[k] = v
}
{{ range $field := .Fields}}
{{- if $field.Default}}
if _, present := asMap[{{$field.Name|quote}}] ; !present {
Expand Down
50 changes: 40 additions & 10 deletions codegen/testserver/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion example/config/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion example/fileupload/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion example/scalars/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion example/starwars/generated/exec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion example/todo/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion example/type-system-extension/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion integration/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4beef02

Please sign in to comment.