route53列出托管区域的输出将引发“不支持索引”错误

I can't parse the output of the response below.

When I include the line:

"fmt.Println(*r["HostedZones"][0])"

it throws:

"type *route53.ListHostedZonesOutput does not support indexing". 

I'd like to retrieve the "Id" and "Name" of each zone in the output. If the type doesn't support indexing, how can I retrieve the parts of the output I need?

Thank you.

package main

import (
        "log"
        "fmt"
        "reflect"
        "github.com/aws/aws-sdk-go/aws/session"
        "github.com/aws/aws-sdk-go/service/route53"
)

func main() {
        r53 := route53.New(session.New())
        r, err := r53.ListHostedZones(&route53.ListHostedZonesInput{})
        if err != nil {
                log.Fatal(err)
        }
        log.Println(r)
        fmt.Println(reflect.TypeOf(r))
        fmt.Println(*r["HostedZones"][0])
}

sample output:

{
  HostedZones: [{
      CallerReference: "5E95CADD-59E-A6",
      Config: {
        PrivateZone: false
      },
      Id: "/hostedzone/Z1Q1TZTO",
      Name: "testzone.local.",
      ResourceRecordSetCount: 4
    },{
      CallerReference: "39895A3C-9B8B-95C2A3",
      Config: {
        PrivateZone: false
      },
      Id: "/hostedzone/Z2MXJQ7",
      Name: "2.168.192.in-addr.arpa.",
      ResourceRecordSetCount: 3
    }],
  IsTruncated: false,
  MaxItems: "100"
}

This is an example of how to get the Id:

fmt.Println(*r.HostedZones[0].Id)

Name:

fmt.Println(*r.HostedZones[0].Name)

you are probably trying to index with the pointer to your struct, your r is a pointer, you can get the deferenced value by doing (*r)["yourkeyhere"]["index"].