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

@@ -52,7 +52,7 @@ func NewSchema(drv dialect.Driver) *Schema { return &Schema{drv: drv} }
func (s *Schema) Create(ctx context.Context, opts ...schema.MigrateOption) error {
migrate, err := schema.NewMigrate(s.drv, opts...)
if err != nil {
return fmt.Errorf("ent/migrate: %v", err)
return fmt.Errorf("ent/migrate: %w", err)
}
return migrate.Create(ctx, Tables...)
}
@@ -70,7 +70,7 @@ func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.Migrat
}
migrate, err := schema.NewMigrate(drv, opts...)
if err != nil {
return fmt.Errorf("ent/migrate: %v", err)
return fmt.Errorf("ent/migrate: %w", err)
}
return migrate.Create(ctx, Tables...)
}