Use errors.Join instead of multierror.Append
- 主要言語
- Go
- スター
- 10.8k
- フォーク
- 1.3k
- 平均マージ
- 2日 36分
- マージ済み PR(30日)
- 26
説明
### What happened?
In gql_node.go:
```go
func (c *Client) Noder(ctx context.Context, id int, opts ...NodeOption) (_ Noder, err error) {
defer func() {
if IsNotFound(err) {
err = multierror.Append(err, entgql.ErrNodeNotFound(id))
}
}()
table, err := c.newNodeOpts(opts).nodeType(ctx, id)
if err != nil {
return nil, err
}
return c.noder(ctx, table, id)
}
// ...
func (c *Client) Noders(ctx context.Context, ids []int, opts ...NodeOption) ([]Noder, error) {
// ...
for i, id := range ids {
if errors[i] == nil {
if noders[i] != nil {
continue
}
errors[i] = entgql.ErrNodeNotFound(id)
} else if IsNotFound(errors[i]) {
errors[i] = multierror.Append(errors[i], entgql.ErrNodeNotFound(id))
}
ctx := graphql.WithPathContext(ctx,
graphql.NewPathWithIndex(i),
)
graphql.AddError(ctx, errors[i])
}
// ...
}
```
### What did you expect?
Use errors.Join instead.
### Minimal graphql.schema and models to reproduce
I think it's always there?
### versions
- `go run github.com/99designs/gqlgen version`? v0.17.45
- `go version`? go version go1.22.2 darwin/arm64
コントリビューションガイド
評価
この issue はまだ評価されていません。