I'm trying to extend the AWS S3 Bucket type to include an additional format and marshal it as JSON, but the marshalling won't pick up the additional field
This is what I have
// AWS has this struct already
type Bucket struct {
// Date the bucket was created.
CreationDate *time.Time `type:"timestamp"
timestampFormat:"iso8601"`
// The name of the bucket.
Name *string `type:"string"`
// contains filtered or unexported fields
}
// Extended struct
type AWSS3Bucket struct {
s3.Bucket
location string
}
somefunc()
{
var region string = "us-west-1"
aws_s3_bucket := AWSS3Bucket{Bucket:*bucket, location:region}
jsonString, err := json.Marshal(&aws_s3_bucket)
fmt.Printf("%s
", jsonString)
}
What I get is just the encoding of Bucket. For e.g., my output from above is always like this without the region included
{"CreationDate":"2016-10-17T22:33:14Z","Name":"test-bucket"}
Any ideas why the region is not being marshalled into the json buffer ?