I have a map that contains two values (Etag & PartNumber) as follows:
upload_out := make(map[int64]string) //key - PartNumber, value - Etag
i eventually want to loop through this map with my values and dump them into into a slice of custom struct as follows:
Parts: []*s3.CompletedPart{
{ // Required
ETag: aws.String("ETag1"),
PartNumber: aws.Int64(PartNumber1),
},
{ // Required
ETag: aws.String("ETag2"),
PartNumber: aws.Int64(PartNumber2),
},
// More values...
},
I guess my problem is not understanding how to properly do this. My attempt loop below only adds one key, value pair all the time. So not all values are being unpacked.
var paths []*s3.CompletedPart
for key, val := range upload_out {
//var unique [10000]*s3.CompletedPart //Attempt unique variable names
name := &s3.CompletedPart{ // this only does one
ETag: &val,
PartNumber: &key,
}
paths = append(paths, name)
}
Any help doing this right will be appreciated.