all: use %w instead of %v to wrap errors (#1275)

* all: use %w instead of %v for nested errors with fmt.Errorf

* all: update generated code to use %w instead of %v for error wrapping
This commit is contained in:
Matthew Gabeler-Lee
2021-03-03 13:05:33 -05:00
committed by GitHub
parent 51d19b8e5b
commit c53b45ddb0
191 changed files with 461 additions and 461 deletions

View File

@@ -482,7 +482,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) {
},
}
if err := sqlgraph.QueryEdges(ctx, uq.driver, _spec); err != nil {
return nil, fmt.Errorf(`query edges "groups": %v`, err)
return nil, fmt.Errorf(`query edges "groups": %w`, err)
}
query.Where(group.IDIn(edgeids...))
neighbors, err := query.All(ctx)
@@ -511,7 +511,7 @@ func (uq *UserQuery) sqlCount(ctx context.Context) (int, error) {
func (uq *UserQuery) sqlExist(ctx context.Context) (bool, error) {
n, err := uq.sqlCount(ctx)
if err != nil {
return false, fmt.Errorf("ent: check existence: %v", err)
return false, fmt.Errorf("ent: check existence: %w", err)
}
return n > 0, nil
}