@@ -321,12 +321,31 @@ def get_blob_container_client(self, account_name, container_name):
321
321
322
322
## [Go](#tab/go)
323
323
324
+ Add the following ` import ` statements:
325
+
324
326
` ` ` go
325
- func getBlobContainerClient (accountName string, containerName string) * azblob .ContainerClient {
326
- // Append the container name to the end of the URI
327
- containerURL := fmt .Printf (" https://%s.blob.core.windows.net/%s" , accountName, containerName)
328
- containerClient := azblob .NewClient (containerURL, nil)
329
- return containerClient
327
+ import (
328
+ " context"
329
+ " fmt"
330
+
331
+ " github.com/Azure/azure-sdk-for-go/sdk/azidentity"
332
+ " github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/container"
333
+ )
334
+ ` ` `
335
+
336
+ Add the following code to create the client object:
337
+
338
+ ` ` ` go
339
+ func getBlobContainerClient (accountName string, containerName string) * container .Client {
340
+ // Create a new container client with token credential
341
+ credential, err := azidentity .NewDefaultAzureCredential (nil)
342
+ handleError (err)
343
+
344
+ containerURL := fmt .Sprintf (" https://%s.blob.core.windows.net/%s" , accountName, containerName)
345
+ containerClient, err := container .NewClient (containerURL, credential, nil)
346
+ handleError (err)
347
+
348
+ return containerClient
330
349
}
331
350
` ` `
332
351
@@ -386,10 +405,8 @@ def get_blob_client(self, blob_service_client: BlobServiceClient, container_name
386
405
387
406
` ` ` go
388
407
func getBlobClient (client * azblob .Client , containerName string, blobName string) * azblob .BlobClient {
389
- // Create the container client using the azblob client object
390
- blobClient := client .ServiceClient ()
391
- .NewContainerClient (containerName)
392
- .NewBlobClient (blobName)
408
+ // Create the blob client using the azblob client object
409
+ blobClient := client .ServiceClient ().NewContainerClient (containerName).NewBlobClient (blobName)
393
410
return blobClient
394
411
}
395
412
` ` `
0 commit comments