mirror of https://github.com/jlelse/GoBlog
Fix group strings (with umlauts...)
This commit is contained in:
parent
fae7893f0b
commit
55902a2de9
3
main.go
3
main.go
|
@ -4,6 +4,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
jsoniter "github.com/json-iterator/go"
|
jsoniter "github.com/json-iterator/go"
|
||||||
)
|
)
|
||||||
|
@ -90,7 +91,7 @@ func main() {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Graceful shutdown
|
// Graceful shutdown
|
||||||
signal.Notify(quit, os.Interrupt)
|
signal.Notify(quit, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
|
||||||
<-quit
|
<-quit
|
||||||
log.Println("Stopping...")
|
log.Println("Stopping...")
|
||||||
|
|
||||||
|
|
2
utils.go
2
utils.go
|
@ -125,7 +125,7 @@ type stringGroup struct {
|
||||||
func groupStrings(toGroup []string) []stringGroup {
|
func groupStrings(toGroup []string) []stringGroup {
|
||||||
stringMap := map[string][]string{}
|
stringMap := map[string][]string{}
|
||||||
for _, s := range toGroup {
|
for _, s := range toGroup {
|
||||||
first := strings.ToUpper(s[:1])
|
first := strings.ToUpper(strings.Split(s, "")[0])
|
||||||
stringMap[first] = append(stringMap[first], s)
|
stringMap[first] = append(stringMap[first], s)
|
||||||
}
|
}
|
||||||
stringGroups := []stringGroup{}
|
stringGroups := []stringGroup{}
|
||||||
|
|
Loading…
Reference in New Issue