From 7aa733c7de51e664ac9f5062f53a14988bb649fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Geisendo=CC=88rfer?= Date: Tue, 19 Mar 2013 11:02:02 +0100 Subject: [PATCH] Docs --- src/cmd/tusd/data_store.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/cmd/tusd/data_store.go b/src/cmd/tusd/data_store.go index d455bb1..d9a8c2c 100644 --- a/src/cmd/tusd/data_store.go +++ b/src/cmd/tusd/data_store.go @@ -64,14 +64,11 @@ func (s *DataStore) GetFileChunks(id string) (chunkSet, error) { return nil, err } 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) - for i, line := range lines { - // last line is always empty, skip it - if lastLine := i+1 == len(lines); lastLine { - break - } - + chunks := make(chunkSet, 0, len(lines)) + for _, line := range lines { entry := logEntry{} if err := json.Unmarshal([]byte(line), &entry); err != nil { return nil, err