func processVolumes(svc *ec2.EC2, pageSize int64, apply func([]*string)) { err := svc.DescribeVolumesPages(&ec2.DescribeVolumesInput{}, func(volumesOut *ec2.DescribeVolumesOutput, lastPage bool) bool { var volumeIds []*string for _, volume := range volumesOut.Volumes { volumeIds = append(volumeIds, volume.VolumeId) } apply(volumeIds) return !lastPage }) kingpin.FatalIfError(err, "Could not retrieve EC2 volumes") }