Reading the documentation for scanner.Bytes(),
func (s *Scanner) Bytes() []byte
Bytes returns the most recent token generated by a call to Scan. The
underlying array may point to data that will be overwritten by a
subsequent call to Scan. It does no allocation.
suggests to me that it is not safe to pass the []byte slice over a
channel as the receiver may receive a slice who's contents are being
mutated by another goroutine. This would also explain why when you ask
for the line as a string, everything works fine, due to the implicit
conversion.
> --
> 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...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
>
>