From 9a4a0669ed76d5c4a4df062952e5379c9938f042 Mon Sep 17 00:00:00 2001 From: Rafael Gumieri Date: Mon, 27 Aug 2018 14:16:11 -0300 Subject: [PATCH] Fix number creation when its bigger than 10 Closes #15 --- lib/notes/main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/notes/main.go b/lib/notes/main.go index b805b4c..94c2476 100644 --- a/lib/notes/main.go +++ b/lib/notes/main.go @@ -92,7 +92,9 @@ func ExistingNames(notePath string) (notesNames []string, err error) { return } - sort.Slice(list, func(a, b int) bool { return list[a].Name() < list[b].Name() }) + sort.Slice(list, func(a, b int) bool { + return NumberFromNoteName(list[a].Name()) < NumberFromNoteName(list[b].Name()) + }) for _, file := range list { if noteRegex.MatchString(file.Name()) {