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.

This commit is contained in:
Sam
2019-10-22 23:44:10 -04:00
parent d6fe3a07cd
commit b00e56e8dd

View File

@ -71,8 +71,8 @@ func getNewMessages(k *Keybase, c chan<- ChatAPI, execOptions []string) {
execCmd.Start() execCmd.Start()
scanner := bufio.NewScanner(stdOut) scanner := bufio.NewScanner(stdOut)
go func(scanner *bufio.Scanner, c chan<- ChatAPI) { go func(scanner *bufio.Scanner, c chan<- ChatAPI) {
var jsonData ChatAPI
for scanner.Scan() { for scanner.Scan() {
var jsonData ChatAPI
json.Unmarshal([]byte(scanner.Text()), &jsonData) json.Unmarshal([]byte(scanner.Text()), &jsonData)
c <- jsonData c <- jsonData
} }