Skip to content

Commit 3b9825f

Browse files
committed
fix ST1005: error strings should not be capitalized (staticcheck)
1 parent 83bb2d2 commit 3b9825f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

migrator.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ func New(opts ...Option) (*Migrator, error) {
6363
}
6464

6565
if len(m.migrations) == 0 {
66-
return nil, errors.New("Migrations must be provided")
66+
return nil, errors.New("migrations must be provided")
6767
}
6868

6969
for _, m := range m.migrations {
7070
switch m.(type) {
7171
case *Migration:
7272
case *MigrationNoTx:
7373
default:
74-
return nil, errors.New("Invalid migration type")
74+
return nil, errors.New("invalid migration type")
7575
}
7676
}
7777

@@ -103,11 +103,11 @@ func (m *Migrator) Migrate(ctx context.Context, db PgxIface) error {
103103
switch mm := migration.(type) {
104104
case *Migration:
105105
if err := migrate(ctx, db, insertVersion, mm, m.onNotice); err != nil {
106-
return fmt.Errorf("Error while running migrations: %w", err)
106+
return fmt.Errorf("error while running migrations: %w", err)
107107
}
108108
case *MigrationNoTx:
109109
if err := migrateNoTx(ctx, db, insertVersion, mm, m.onNotice); err != nil {
110-
return fmt.Errorf("Error while running migrations: %w", err)
110+
return fmt.Errorf("error while running migrations: %w", err)
111111
}
112112
}
113113
}
@@ -185,18 +185,18 @@ func migrate(ctx context.Context, db PgxIface, insertVersion string, migration *
185185
defer func() {
186186
if err != nil {
187187
if errRb := tx.Rollback(ctx); errRb != nil {
188-
err = fmt.Errorf("Error rolling back: %s\n%s", errRb, err)
188+
err = fmt.Errorf("error rolling back: %s\n%s", errRb, err)
189189
}
190190
return
191191
}
192192
err = tx.Commit(ctx)
193193
}()
194194
notice(fmt.Sprintf("Applying migration named '%s'...", migration.Name))
195195
if err = migration.Func(ctx, tx); err != nil {
196-
return fmt.Errorf("Error executing golang migration: %w", err)
196+
return fmt.Errorf("error executing golang migration: %w", err)
197197
}
198198
if _, err = tx.Exec(ctx, insertVersion); err != nil {
199-
return fmt.Errorf("Error updating migration versions: %w", err)
199+
return fmt.Errorf("error updating migration versions: %w", err)
200200
}
201201
notice(fmt.Sprintf("Applied migration named '%s'", migration.Name))
202202

@@ -206,10 +206,10 @@ func migrate(ctx context.Context, db PgxIface, insertVersion string, migration *
206206
func migrateNoTx(ctx context.Context, db PgxIface, insertVersion string, migration *MigrationNoTx, notice func(string)) error {
207207
notice(fmt.Sprintf("Applying no tx migration named '%s'...", migration.Name))
208208
if err := migration.Func(ctx, db); err != nil {
209-
return fmt.Errorf("Error executing golang migration: %w", err)
209+
return fmt.Errorf("error executing golang migration: %w", err)
210210
}
211211
if _, err := db.Exec(ctx, insertVersion); err != nil {
212-
return fmt.Errorf("Error updating migration versions: %w", err)
212+
return fmt.Errorf("error updating migration versions: %w", err)
213213
}
214214
notice(fmt.Sprintf("Applied no tx migration named '%s'...", migration.Name))
215215

0 commit comments

Comments
 (0)