If you wrote your code like mine, there's a good chance that you've got a little state machine going on directly inside your main function.
Let's refactor our code so that we have a nice reusable function that reads lines from a TCP connection.
func getLinesChannel(f io.ReadCloser) <-chan string
It should contain all the logic you've already written that keeps track of the current line's contents, reads 8 bytes at a time, etc. The differences are that now:
"read: " or add a newline character at the end. Instead, it sends one line at a time to the channel.os.File implements io.ReadCloser, so you can pass your file directly to your new function."read: " and followed by a newline.Your code should behave the same way as before, but now the logic for reading lines is encapsulated in a reusable function.
Run and submit the CLI tests.