]> Sergey Matveev's repositories - mmc.git/commitdiff
cmd/scrollback reversed order
authorSergey Matveev <stargrave@stargrave.org>
Sun, 12 Mar 2023 10:15:19 +0000 (13:15 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 12 Mar 2023 12:42:11 +0000 (15:42 +0300)
cmd/scrollback/main.go

index 410d290afe247cf48b9de49ac56230ba57281d2c..2f48d109cda30459928b93e32c11992fd76e660f 100644 (file)
@@ -52,10 +52,11 @@ func main() {
                log.Fatalln(err)
        }
        w := recfile.NewWriter(os.Stdout)
-       for _, post := range list.ToSlice() {
+       slice := list.ToSlice()
+       for i := len(slice) - 1; i >= 0; i-- {
                if err = mmc.PostToRec(
                        w, users,
-                       mmc.Post{P: post, E: model.WebsocketEventPosted},
+                       mmc.Post{P: slice[i], E: model.WebsocketEventPosted},
                ); err != nil {
                        log.Fatalln(err)
                }