Skip to content

Commit 352d5b5

Browse files
committed
optimize code logic
1 parent 969bf8e commit 352d5b5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tencentcloud/data_source_tc_images.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ func dataSourceTencentCloudImagesRead(d *schema.ResourceData, meta interface{})
268268
imageList := make([]map[string]interface{}, 0, len(results))
269269
ids := make([]string, 0, len(results))
270270
for _, image := range results {
271-
snapshots, err := imagesReadSnapshotByIds(image, cbsService, ctx)
271+
snapshots, err := imagesReadSnapshotByIds(ctx, cbsService, image)
272272
if err != nil {
273273
return err
274274
}
@@ -311,7 +311,7 @@ func dataSourceTencentCloudImagesRead(d *schema.ResourceData, meta interface{})
311311
return nil
312312
}
313313

314-
func imagesReadSnapshotByIds(image *cvm.Image, cbsService CbsService, ctx context.Context) (snapshotResults []map[string]interface{}, errSnap error) {
314+
func imagesReadSnapshotByIds(ctx context.Context, cbsService CbsService, image *cvm.Image) (snapshotResults []map[string]interface{}, errSnap error) {
315315
if len(image.SnapshotSet) == 0 {
316316
return
317317
}

tencentcloud/service_tencentcloud_cbs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ func (me *CbsService) DescribeSnapshotByIds(ctx context.Context, snapshotIdsPara
250250
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n",
251251
logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
252252

253-
if response == nil || len(response.Response.SnapshotSet) < 1 {
253+
if len(response.Response.SnapshotSet) < 1 {
254254
break
255255
}
256256

0 commit comments

Comments
 (0)