无法在GO中解组AWS SQS消息

Folks,

Am trying to unmarshal a message from an SQS FIFO queue, and am getting

cannot unmarshal array into Go struct field SendMessageInput.MessageAttributes of type map[string]*sqs.MessageAttributeValue
// unmarshal for the sqs message
var publishedMessage sqs.SendMessageInput
if err := json.Unmarshal([]byte(*msg.Body), &publishedMessage); err != nil {
  onError(err)
  continue
}

// unmarhsal for the message sent
var result Message
if err := json.Unmarshal([]byte(*publishedMessage.MessageBody), &result); err != nil {
    onError(err)
    continue
}

The Message itself looks ok when i look at the message via the SQS console.

Here is a sample messageAttributes section from the message:

"messageAttributes":[{"name":"foo","dataType":"String","attributeValue":"something"},{"name":"uid","dataType":"String","attributeValue":"26799e9c-9455-11e9-bc42-526af7764f64"}]

From the SDK documentation:

// Each message attribute consists of a Name, Type, and Value. For more information,
    // see Amazon SQS Message Attributes (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html)
    // in the Amazon Simple Queue Service Developer Guide.
    MessageAttributes map[string]*MessageAttributeValue `locationName:"MessageAttribute" locationNameKey:"Name" locationNameValue:"Value" type:"map" flattened:"true"`

What am I doing wrong here folks?

For those who stumble upon this...

// Message encapsulates all the information to publish in a message
type Message struct {
    Body              json.RawMessage            `json:"body"`
    Headers           map[string]json.RawMessage `json:"headers"`
    Environment       string                     `json:"env"`
    PublishTime       int64                      `json:"publishTime"`
    MessageAttributes []Attributes               `json:"messageAttributes"`
}

for _, msg := range resp.Messages {

  var result Message
  if err := json.Unmarshal([]byte(*msg.Body), &result); err != nil {
    onError(err)
    continue
  }

  metadata := &Metadata{
    ReceiptHandle: *msg.ReceiptHandle,
    MD5OfBody:     *msg.MD5OfBody,
    SQSMessageID:  *msg.MessageId,
    ReceiveCount:  *msg.Attributes[sqs.MessageSystemAttributeNameApproximateReceiveCount],
  }

  onMessage(result, *metadata)

}