Skip to content

Commit 7bb8b6b

Browse files
committed
Move Regexp so that we only compile it once.
1 parent f2d2c24 commit 7bb8b6b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

migrate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const (
2626
)
2727

2828
var tableName = "gorp_migrations"
29+
var numberPrefixRegex = regexp.MustCompile(`^(\d+).*$`)
2930

3031
// Set the name of the table used to store migration info.
3132
//
@@ -60,8 +61,7 @@ func (m Migration) isNumeric() bool {
6061
}
6162

6263
func (m Migration) NumberPrefixMatches() []string {
63-
r := regexp.MustCompile(`^(\d+).*$`)
64-
return r.FindStringSubmatch(m.Id)
64+
return numberPrefixRegex.FindStringSubmatch(m.Id)
6565
}
6666

6767
func (m Migration) VersionInt() int64 {

0 commit comments

Comments
 (0)