update Len, Less and Swap to be more consistent

This commit is contained in:
mattes 2014-08-11 04:00:45 +02:00
parent 7e57bf3c56
commit 9b4dd699e2
1 changed files with 6 additions and 6 deletions

View File

@ -236,17 +236,17 @@ func parseFilenameSchema(filename string, filenameRegex *regexp.Regexp) (version
// implement sort interface ...
// Len is the number of elements in the collection.
func (f MigrationFiles) Len() int {
return len(f)
func (mf MigrationFiles) Len() int {
return len(mf)
}
// Less reports whether the element with
// index i should sort before the element with index j.
func (f MigrationFiles) Less(i, j int) bool {
return f[i].Version < f[j].Version
func (mf MigrationFiles) Less(i, j int) bool {
return mf[i].Version < mf[j].Version
}
// Swap swaps the elements with indexes i and j.
func (f MigrationFiles) Swap(i, j int) {
f[i], f[j] = f[j], f[i]
func (mf MigrationFiles) Swap(i, j int) {
mf[i], mf[j] = mf[j], mf[i]
}