Skip to content

Instantly share code, notes, and snippets.

@aybabtme
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aybabtme/1da359fa2212f858ccec to your computer and use it in GitHub Desktop.
Save aybabtme/1da359fa2212f858ccec to your computer and use it in GitHub Desktop.
switch {
case olderr != nil && newerr != nil:
return diff, fmt.Errorf("reading both source, %v", olderr)
case olderr != nil:
return diff, fmt.Errorf("reading old source, %v", olderr)
case newerr != nil:
return diff, fmt.Errorf("reading new source, %v", newerr)
default:
return diff, nil
}
for {
line, err := rd.ReadBytes('\n')
switch err {
case io.EOF:
return nil
case nil:
default:
return err
}
total += uint64(len(line) + 1)
lines <- line
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment