Golang SQS GetQueueAttributesInput

Trying to get attributes for an AWS SQS queue. I am just starting to use golang sdk v2. I am getting the following error during compile:

cannot use []*string{…} (type []*string) as type []“github.com/aws/aws-sdk-go-v2/service/sqs/types”.QueueAttributeName in field value

Code being executed is:

params := &sqs.GetQueueAttributesInput{
                  QueueUrl: aws.String(queueUrl[i]),
                  AttributeNames: []*string{
                              aws.String("QueueArn"),
                  },
 }
 resp, err := client.GetQueueAttributes(context.TODO(), params)

Is this a golang aws sdk v1/v2 issue? Any ideas on how to fix this? Any help would be greatly appreciated.

the error says you should not use a slice of string pointers, but a slice of types.QueueAttributeName.

Most likely your aws library comes with some predefined constants, one of them for QueueArn.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.