keybase / go-keybase-chat-bot

Official Go Keybase chat bot SDK
BSD 3-Clause "New" or "Revised" License
111 stars 38 forks source link

Use bufio.Reader instead of Scanner for most API calls #20

Closed nathanmsmith closed 5 years ago

nathanmsmith commented 5 years ago

For conversations with long histories, bufio.Scanner is not able to parse the entire output in one scan. As per the Go docs' reccomendation:

Programs that need more control over error handling or large tokens, or must run sequential scans on a reader, should use bufio.Reader instead.

I opted to use bufio.Reader instead.

This change only affects functions like GetTextMessages and sends; the listen functionality still uses scanners because bufio.Scanner seems perfectly capable of handling message output from a listen. This could change in the future and may be worth revisiting, but I figured I wouldn't change what isn't broken.

mmaxim commented 5 years ago

Does this work on Windows?