Some data might have been read even if err != nil. Maybe always printing out msg could give you a hint?
https://pkg.go.dev/bufio#Reader.ReadBytes -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/393ee0f8-457f-45ca-877e-a2e550fca9fan%40googlegroups.com.