func (d *Downloader) downloadImage(artifact *ct.Artifact, info chan *ct.ImagePullInfo) error { info <- &ct.ImagePullInfo{ Name: artifact.Meta["flynn.component"], Type: ct.ImagePullTypeImage, Artifact: artifact, } for _, rootfs := range artifact.Manifest().Rootfs { for _, layer := range rootfs.Layers { if layer.Type != ct.ImageLayerTypeSquashfs { continue } info <- &ct.ImagePullInfo{ Name: artifact.Meta["flynn.component"], Type: ct.ImagePullTypeLayer, Layer: layer, } if err := d.downloadSquashfsLayer(layer, artifact.LayerURL(layer), artifact.Meta); err != nil { return fmt.Errorf("error downloading layer: %s", err) } } } return nil }