mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
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:
committed by
GitHub
parent
51d19b8e5b
commit
c53b45ddb0
@@ -40,7 +40,7 @@ func Do(ctx context.Context, client *ent.Client) error {
|
||||
SetValue(1).
|
||||
Save(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("creating the head: %v", err)
|
||||
return fmt.Errorf("creating the head: %w", err)
|
||||
}
|
||||
curr := head
|
||||
// Generate the following linked-list: 1<->2<->3<->4<->5.
|
||||
@@ -77,7 +77,7 @@ func Do(ctx context.Context, client *ent.Client) error {
|
||||
// Check that the change actually applied:
|
||||
prev, err := head.QueryPrev().Only(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("getting head's prev: %v", err)
|
||||
return fmt.Errorf("getting head's prev: %w", err)
|
||||
}
|
||||
fmt.Printf("\n%v", prev.Value == tail.Value)
|
||||
// Output: true
|
||||
|
||||
Reference in New Issue
Block a user