Skip to content

Commit 7f07244

Browse files
committed
chore: lazy init subgraphErrors
1 parent 1526767 commit 7f07244

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

v2/pkg/engine/resolve/context.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ func (c *Context) SubgraphErrors() error {
196196
}
197197

198198
func (c *Context) appendSubgraphErrors(ds DataSourceInfo, errs ...error) {
199+
if c.subgraphErrors == nil {
200+
c.subgraphErrors = make(map[string]error)
201+
}
199202
c.subgraphErrors[ds.Name] = errors.Join(c.subgraphErrors[ds.Name], errors.Join(errs...))
200203
}
201204

@@ -209,8 +212,7 @@ func NewContext(ctx context.Context) *Context {
209212
panic("nil context.Context")
210213
}
211214
return &Context{
212-
ctx: ctx,
213-
subgraphErrors: make(map[string]error),
215+
ctx: ctx,
214216
}
215217
}
216218

0 commit comments

Comments
 (0)