Skip to content

Commit 3181ab1

Browse files
committed
Use const none
1 parent 6eb5e67 commit 3181ab1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

migrate.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,8 @@ func PlanMigration(db *sql.DB, dialect string, m MigrationSource, dir MigrationD
395395
// Searches the arrays for the latest elements with common ids.
396396
// Returns the indexes of the common id.
397397
func lastCommonMigration(left []*Migration, right []*Migration) (int, int) {
398-
xIndexMatch := -1
398+
const none = -1
399+
xIndexMatch := none
399400
yIndexMatch := 0
400401
for i := 0; i < len(left); i++ {
401402
existingId := left[i].Id
@@ -407,8 +408,9 @@ func lastCommonMigration(left []*Migration, right []*Migration) (int, int) {
407408
}
408409
}
409410
}
410-
if xIndexMatch == -1 {
411-
return -1, -1 // We never found a match; the arrays have nothing in common
411+
if xIndexMatch == none {
412+
// We never found a match; the arrays have nothing in common
413+
return none, none
412414
}
413415
return xIndexMatch, yIndexMatch
414416
}

0 commit comments

Comments
 (0)