From 55902a2de95a74662091e77f2a6c62b4feca3d3e Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Mon, 11 Jan 2021 17:45:57 +0100 Subject: [PATCH] Fix group strings (with umlauts...) --- main.go | 3 ++- utils.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index d0343c2..01ac855 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ import ( "log" "os" "os/signal" + "syscall" jsoniter "github.com/json-iterator/go" ) @@ -90,7 +91,7 @@ func main() { }() // Graceful shutdown - signal.Notify(quit, os.Interrupt) + signal.Notify(quit, os.Interrupt, syscall.SIGINT, syscall.SIGTERM) <-quit log.Println("Stopping...") diff --git a/utils.go b/utils.go index 743d1ca..fba88e2 100644 --- a/utils.go +++ b/utils.go @@ -125,7 +125,7 @@ type stringGroup struct { func groupStrings(toGroup []string) []stringGroup { stringMap := map[string][]string{} for _, s := range toGroup { - first := strings.ToUpper(s[:1]) + first := strings.ToUpper(strings.Split(s, "")[0]) stringMap[first] = append(stringMap[first], s) } stringGroups := []stringGroup{}