summaryrefslogtreecommitdiffstats
path: root/hugolib/pageSort.go
diff options
context:
space:
mode:
authorbep <bjorn.erik.pedersen@gmail.com>2015-03-07 12:53:20 +0100
committerbep <bjorn.erik.pedersen@gmail.com>2015-03-07 12:53:20 +0100
commite007c9b25d076f5705afb63fda4f3abd3d05b7b8 (patch)
treed0fe0ef5f1079a304fff0689e3d1d04841b98455 /hugolib/pageSort.go
parent5759007874afc1948f0fab0a97f2184bff686b54 (diff)
hugolib: apply some more Golint rules
Diffstat (limited to 'hugolib/pageSort.go')
-rw-r--r--hugolib/pageSort.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/hugolib/pageSort.go b/hugolib/pageSort.go
index dbbdc4c20..da068a825 100644
--- a/hugolib/pageSort.go
+++ b/hugolib/pageSort.go
@@ -21,13 +21,13 @@ import (
* Implementation of a custom sorter for Pages
*/
-// A type to implement the sort interface for Pages
+// A PageSorter implements the sort interface for Pages
type PageSorter struct {
pages Pages
by PageBy
}
-// Closure used in the Sort.Less method.
+// PageBy is a closure used in the Sort.Less method.
type PageBy func(p1, p2 *Page) bool
func (by PageBy) Sort(pages Pages) {
@@ -41,9 +41,8 @@ func (by PageBy) Sort(pages Pages) {
var DefaultPageSort = func(p1, p2 *Page) bool {
if p1.Weight == p2.Weight {
return p1.Date.Unix() > p2.Date.Unix()
- } else {
- return p1.Weight < p2.Weight
}
+ return p1.Weight < p2.Weight
}
func (ps *PageSorter) Len() int { return len(ps.pages) }
@@ -59,9 +58,8 @@ func (p Pages) Sort() {
func (p Pages) Limit(n int) Pages {
if len(p) < n {
return p[0:n]
- } else {
- return p
}
+ return p
}
func (p Pages) ByWeight() Pages {