From b00e56e8dd3cbcf3186946c0b30a3ec48caacb82 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 22 Oct 2019 23:44:10 -0400 Subject: [PATCH] Create new jsonData var with every new message instead of reusing the same var. This fixes the bug where IsEphemeral is true for every message after one ephemeral message is received, and probably countless other unknown bugs. --- chat.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chat.go b/chat.go index 73fa993..f51d8bc 100644 --- a/chat.go +++ b/chat.go @@ -71,8 +71,8 @@ func getNewMessages(k *Keybase, c chan<- ChatAPI, execOptions []string) { execCmd.Start() scanner := bufio.NewScanner(stdOut) go func(scanner *bufio.Scanner, c chan<- ChatAPI) { - var jsonData ChatAPI for scanner.Scan() { + var jsonData ChatAPI json.Unmarshal([]byte(scanner.Text()), &jsonData) c <- jsonData }