Skip to content

Commit

Permalink
Use const none
Browse files Browse the repository at this point in the history
  • Loading branch information
ericklaus-wf committed Nov 2, 2016
1 parent 765a3c3 commit 8f48137
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ func PlanMigration(db *sql.DB, dialect string, m MigrationSource, dir MigrationD
// Searches the arrays for the latest elements with common ids.
// Returns the indexes of the common id.
func lastCommonMigration(left []*Migration, right []*Migration) (int, int) {
xIndexMatch := -1
const none = -1
xIndexMatch := none
yIndexMatch := 0
for i := 0; i < len(left); i++ {
existingId := left[i].Id
Expand All @@ -407,8 +408,9 @@ func lastCommonMigration(left []*Migration, right []*Migration) (int, int) {
}
}
}
if xIndexMatch == -1 {
return -1, -1 // We never found a match; the arrays have nothing in common
if xIndexMatch == none {
// We never found a match; the arrays have nothing in common
return none, none
}
return xIndexMatch, yIndexMatch
}
Expand Down

0 comments on commit 8f48137

Please sign in to comment.