Skip to content

Commit

Permalink
r/storage_blob: refactoring from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Sep 2, 2019
1 parent 28f97a6 commit 91f460c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions azurerm/internal/services/storage/blobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ func (sbu BlobUpload) createEmptyPageBlob(ctx context.Context) error {
ContentType: utils.String(sbu.ContentType),
MetaData: sbu.MetaData,
}
// TODO: access tiers?
if _, err := sbu.Client.PutPageBlob(ctx, sbu.AccountName, sbu.ContainerName, sbu.BlobName, input); err != nil {
return fmt.Errorf("Error PutPageBlob: %s", err)
}
Expand Down Expand Up @@ -282,8 +281,7 @@ func (sbu BlobUpload) blobPageUploadWorker(ctx context.Context, uploadCtx blobPa
size := end - start + 1

chunk := make([]byte, size)
_, err := page.section.Read(chunk)
if err != nil && err != io.EOF {
if _, err := page.section.Read(chunk); err != nil && err != io.EOF {
uploadCtx.errors <- fmt.Errorf("Error reading source file %q at offset %d: %s", sbu.Source, page.offset, err)
uploadCtx.wg.Done()
continue
Expand All @@ -295,7 +293,7 @@ func (sbu BlobUpload) blobPageUploadWorker(ctx context.Context, uploadCtx blobPa
Content: chunk,
}

if _, err = sbu.Client.PutPageUpdate(ctx, sbu.AccountName, sbu.ContainerName, sbu.BlobName, input); err != nil {
if _, err := sbu.Client.PutPageUpdate(ctx, sbu.AccountName, sbu.ContainerName, sbu.BlobName, input); err != nil {
uploadCtx.errors <- fmt.Errorf("Error writing page at offset %d for file %q: %s", page.offset, sbu.Source, err)
uploadCtx.wg.Done()
continue
Expand Down

0 comments on commit 91f460c

Please sign in to comment.