This commit is contained in:
Felix Geisendörfer 2013-03-19 11:02:02 +01:00
parent e8d2364048
commit 7aa733c7de
1 changed files with 4 additions and 7 deletions

View File

@ -64,14 +64,11 @@ func (s *DataStore) GetFileChunks(id string) (chunkSet, error) {
return nil, err return nil, err
} }
lines := strings.Split(string(data), "\n") lines := strings.Split(string(data), "\n")
// last line is always empty, lets skip it
lines = lines[:len(lines)-1]
chunks := make(chunkSet, 0, len(lines)-1) chunks := make(chunkSet, 0, len(lines))
for i, line := range lines { for _, line := range lines {
// last line is always empty, skip it
if lastLine := i+1 == len(lines); lastLine {
break
}
entry := logEntry{} entry := logEntry{}
if err := json.Unmarshal([]byte(line), &entry); err != nil { if err := json.Unmarshal([]byte(line), &entry); err != nil {
return nil, err return nil, err