Closed StevenMaude closed 8 years ago
Care to rework it and send a pr?
On 29 Aug 2016 11:50 am, "Steven Maude" notifications@github.com wrote:
In the Chapter 5 exercises https://miek.nl/go/#exercises-3, the two solutions for the cat implementation are identical, aside from the inclusion of line labelling numbers.
However, the second is supposed to fix a bug in the first.
Diff:
7c7
< "io" 1
"io" 11c11
< var numberFlag = flag.Bool("n", false, "number each line") 2
var numberFlag = flag.Bool("n", false, "number each line") 13c13
< func cat(r *bufio.Reader) { 3
func cat(r *bufio.Reader) { 16,17c16,17 < buf, e := r.ReadBytes('\n') 4
< if e == io.EOF { 5
buf, e := r.ReadBytes('\n') if e == io.EOF {
20c20
< if *numberFlag { 6
if *numberFlag {
23c23
< } else { 7
} else {
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/miekg/learninggo/issues/21, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVkW0Y3-q3htc2Cp-icaLBf6nbmQLx5ks5qkrl3gaJpZM4JvXCO .
In the Chapter 5 exercises, the two solutions for the cat implementation are identical, aside from the inclusion of line labelling numbers.
However, the second is supposed to fix a bug in the first.
Diff of the two code snippets: