Skip to content

Commit

Permalink
Merge pull request #24 from jf/codetweaks
Browse files Browse the repository at this point in the history
blob.go: more idiomatic and clearer 'for' loop
  • Loading branch information
ahmetb committed Feb 3, 2015
2 parents 0d03132 + 1bff748 commit c1f7c85
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions clients/storage/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,10 +527,9 @@ func (b BlobStorageClient) putBlockBlob(container, name string, blob io.Reader,
} else {
// Does not fit into one block. Upload block by block then commit the block list
blockList := []Block{}
blockNum := 0

// Put blocks
for {
for blockNum := 0; ; blockNum++ {
id := base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%011d", blockNum)))
data := chunk[:n]
err = b.PutBlock(container, name, id, data)
Expand All @@ -547,8 +546,6 @@ func (b BlobStorageClient) putBlockBlob(container, name string, blob io.Reader,
if err == io.EOF {
break
}

blockNum++
}

// Commit block list
Expand Down

0 comments on commit c1f7c85

Please sign in to comment.