hugolib: apply some more Golint rules

This commit is contained in:
bep
2015-03-07 12:53:20 +01:00
parent 5759007874
commit e007c9b25d
6 changed files with 33 additions and 34 deletions

View File

@@ -184,18 +184,18 @@ func (wp WeightedPages) Next(cur *Page) *Page {
return nil
}
func (p WeightedPages) Len() int { return len(p) }
func (p WeightedPages) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
func (p WeightedPages) Sort() { sort.Stable(p) }
func (p WeightedPages) Count() int { return len(p) }
func (p WeightedPages) Less(i, j int) bool {
if p[i].Weight == p[j].Weight {
if p[i].Page.Date.Equal(p[j].Page.Date) {
return p[i].Page.Title < p[j].Page.Title
func (wp WeightedPages) Len() int { return len(wp) }
func (wp WeightedPages) Swap(i, j int) { wp[i], wp[j] = wp[j], wp[i] }
func (wp WeightedPages) Sort() { sort.Stable(wp) }
func (wp WeightedPages) Count() int { return len(wp) }
func (wp WeightedPages) Less(i, j int) bool {
if wp[i].Weight == wp[j].Weight {
if wp[i].Page.Date.Equal(wp[j].Page.Date) {
return wp[i].Page.Title < wp[j].Page.Title
}
return p[i].Page.Date.After(p[i].Page.Date)
return wp[i].Page.Date.After(wp[i].Page.Date)
}
return p[i].Weight < p[j].Weight
return wp[i].Weight < wp[j].Weight
}
// TODO mimic PagesSorter for WeightedPages