@@ -60,19 +60,17 @@ type layer struct {
6060 Content io.ReadCloser
6161}
6262
63- type opqDirs []string
64-
6563type DockerExtractor struct {
6664 Option types.DockerOption
6765}
6866
69- func NewDockerExtractor (option types.DockerOption ) DockerExtractor {
67+ func NewDockerExtractor (option types.DockerOption ) extractor. Extractor {
7068 RegisterRegistry (& gcr.GCR {})
7169 RegisterRegistry (& ecr.ECR {})
7270 return DockerExtractor {Option : option }
7371}
7472
75- func applyLayers (layerPaths []string , filesInLayers map [string ]extractor.FileMap , opqInLayers map [string ]opqDirs ) (extractor.FileMap , error ) {
73+ func applyLayers (layerPaths []string , filesInLayers map [string ]extractor.FileMap , opqInLayers map [string ]extractor. OPQDirs ) (extractor.FileMap , error ) {
7674 sep := "/"
7775 nestedMap := nested.Nested {}
7876 for _ , layerPath := range layerPaths {
@@ -190,7 +188,8 @@ func (d DockerExtractor) Extract(ctx context.Context, imageName string, filename
190188
191189 ch := make (chan layer )
192190 errCh := make (chan error )
193- layerIDs := []string {}
191+ var layerIDs []string
192+
194193 for _ , ref := range m .Manifest .Layers {
195194 layerIDs = append (layerIDs , string (ref .Digest ))
196195 go func (d digest.Digest ) {
@@ -203,6 +202,7 @@ func (d DockerExtractor) Extract(ctx context.Context, imageName string, filename
203202 errCh <- xerrors .Errorf ("failed to download the layer(%s): %w" , d , err )
204203 return
205204 }
205+
206206 rc , err = cache .Set (string (d ), rc )
207207 if err != nil {
208208 log .Print (err )
@@ -218,7 +218,7 @@ func (d DockerExtractor) Extract(ctx context.Context, imageName string, filename
218218 }
219219
220220 filesInLayers := make (map [string ]extractor.FileMap )
221- opqInLayers := make (map [string ]opqDirs )
221+ opqInLayers := make (map [string ]extractor. OPQDirs )
222222 for i := 0 ; i < len (m .Manifest .Layers ); i ++ {
223223 var l layer
224224 select {
@@ -262,7 +262,7 @@ func (d DockerExtractor) Extract(ctx context.Context, imageName string, filename
262262func (d DockerExtractor ) ExtractFromFile (ctx context.Context , r io.Reader , filenames []string ) (extractor.FileMap , error ) {
263263 manifests := make ([]manifest , 0 )
264264 filesInLayers := map [string ]extractor.FileMap {}
265- opqInLayers := make (map [string ]opqDirs )
265+ opqInLayers := make (map [string ]extractor. OPQDirs )
266266
267267 tarFiles := make (map [string ][]byte )
268268
@@ -330,9 +330,9 @@ func (d DockerExtractor) ExtractFromFile(ctx context.Context, r io.Reader, filen
330330 return fileMap , nil
331331}
332332
333- func (d DockerExtractor ) ExtractFiles (layer io.Reader , filenames []string ) (extractor.FileMap , opqDirs , error ) {
333+ func (d DockerExtractor ) ExtractFiles (layer io.Reader , filenames []string ) (extractor.FileMap , extractor. OPQDirs , error ) {
334334 data := make (map [string ][]byte )
335- opqDirs := opqDirs {}
335+ opqDirs := extractor. OPQDirs {}
336336
337337 tr := tar .NewReader (layer )
338338 for {
0 commit comments