Skip to content

Commit 3502e02

Browse files
committed
Merge pull request denisenkom#28 from ngauthier/fix-err-handling-typo
fix check on err when using err2
2 parents 2cf4b2c + 1333184 commit 3502e02

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

migrate/migrate.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func Up(pipe chan interface{}, url, migrationsPath string) {
2727

2828
applyMigrationFiles, err := files.ToLastFrom(version)
2929
if err != nil {
30-
if err2 := d.Close(); err != nil {
30+
if err2 := d.Close(); err2 != nil {
3131
pipe <- err2
3232
}
3333
go pipep.Close(pipe, err)
@@ -42,14 +42,14 @@ func Up(pipe chan interface{}, url, migrationsPath string) {
4242
break
4343
}
4444
}
45-
if err2 := d.Close(); err != nil {
46-
pipe <- err2
45+
if err := d.Close(); err != nil {
46+
pipe <- err
4747
}
4848
go pipep.Close(pipe, nil)
4949
return
5050
} else {
51-
if err2 := d.Close(); err != nil {
52-
pipe <- err2
51+
if err := d.Close(); err != nil {
52+
pipe <- err
5353
}
5454
go pipep.Close(pipe, nil)
5555
return
@@ -74,7 +74,7 @@ func Down(pipe chan interface{}, url, migrationsPath string) {
7474

7575
applyMigrationFiles, err := files.ToFirstFrom(version)
7676
if err != nil {
77-
if err2 := d.Close(); err != nil {
77+
if err2 := d.Close(); err2 != nil {
7878
pipe <- err2
7979
}
8080
go pipep.Close(pipe, err)
@@ -89,13 +89,13 @@ func Down(pipe chan interface{}, url, migrationsPath string) {
8989
break
9090
}
9191
}
92-
if err2 := d.Close(); err != nil {
92+
if err2 := d.Close(); err2 != nil {
9393
pipe <- err2
9494
}
9595
go pipep.Close(pipe, nil)
9696
return
9797
} else {
98-
if err2 := d.Close(); err != nil {
98+
if err2 := d.Close(); err2 != nil {
9999
pipe <- err2
100100
}
101101
go pipep.Close(pipe, nil)
@@ -161,7 +161,7 @@ func Migrate(pipe chan interface{}, url, migrationsPath string, relativeN int) {
161161

162162
applyMigrationFiles, err := files.From(version, relativeN)
163163
if err != nil {
164-
if err2 := d.Close(); err != nil {
164+
if err2 := d.Close(); err2 != nil {
165165
pipe <- err2
166166
}
167167
go pipep.Close(pipe, err)
@@ -176,13 +176,13 @@ func Migrate(pipe chan interface{}, url, migrationsPath string, relativeN int) {
176176
break
177177
}
178178
}
179-
if err2 := d.Close(); err != nil {
179+
if err2 := d.Close(); err2 != nil {
180180
pipe <- err2
181181
}
182182
go pipep.Close(pipe, nil)
183183
return
184184
}
185-
if err2 := d.Close(); err != nil {
185+
if err2 := d.Close(); err2 != nil {
186186
pipe <- err2
187187
}
188188
go pipep.Close(pipe, nil)

0 commit comments

Comments
 (0)