Commit aa89f30f authored by Abiola Ibrahim's avatar Abiola Ibrahim

renamed sorter to byDate.

parent 7b29568e
...@@ -28,12 +28,12 @@ type PageLink struct { ...@@ -28,12 +28,12 @@ type PageLink struct {
Url string Url string
} }
// pageLinkSorter sorts PageLink by newest date to oldest. // byDate sorts PageLink by newest date to oldest.
type pageLinkSorter []PageLink type byDate []PageLink
func (p pageLinkSorter) Len() int { return len(p) } func (p byDate) Len() int { return len(p) }
func (p pageLinkSorter) Swap(i, j int) { p[i], p[j] = p[j], p[i] } func (p byDate) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
func (p pageLinkSorter) Less(i, j int) bool { return p[i].Date.After(p[j].Date) } func (p byDate) Less(i, j int) bool { return p[i].Date.After(p[j].Date) }
type linkGen struct { type linkGen struct {
generating bool generating bool
...@@ -120,7 +120,7 @@ func (l *linkGen) generateLinks(md Markdown, cfg *Config) { ...@@ -120,7 +120,7 @@ func (l *linkGen) generateLinks(md Markdown, cfg *Config) {
}) })
// sort by newest date // sort by newest date
sort.Sort(pageLinkSorter(cfg.Links)) sort.Sort(byDate(cfg.Links))
cfg.Unlock() cfg.Unlock()
l.Lock() l.Lock()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment