Small refactor to dataSplit

This commit is contained in:
David Howden 2015-05-24 13:13:06 +10:00
parent 5da0ca1f03
commit 47d9285956

View File

@ -76,9 +76,10 @@ func dataSplit(b []byte, enc byte) ([][]byte, error) {
if err != nil {
return nil, err
}
result := bytes.SplitN(b, delim, 2)
if len(result) <= 1 {
result := bytes.SplitN(b, delim, 2)
if len(result) != 2 {
return result, nil
}
@ -87,7 +88,6 @@ func dataSplit(b []byte, enc byte) ([][]byte, error) {
result[0] = append(result[0], make([]byte, 0)...)
result[1] = result[1][1:]
}
return result, nil
}