mirror of
https://github.com/anchore/syft.git
synced 2026-11-03 16:06:36 +01:00
use filetree reader instead of filetree
This commit is contained in:
@@ -9,12 +9,12 @@ import (
|
||||
|
||||
type Scope struct {
|
||||
Option Option
|
||||
Trees []*tree.FileTree
|
||||
Trees []tree.FileTreeReader
|
||||
Image *image.Image
|
||||
}
|
||||
|
||||
func NewScope(img *image.Image, option Option) (Scope, error) {
|
||||
var trees = make([]*tree.FileTree, 0)
|
||||
var trees = make([]tree.FileTreeReader, 0)
|
||||
|
||||
if img == nil {
|
||||
return Scope{}, fmt.Errorf("no image given")
|
||||
|
||||
@@ -81,7 +81,11 @@ func TestScope(t *testing.T) {
|
||||
t.Fatalf("mismatched tree lengths: %d!=%d", len(actual.Trees), len(c.expectedTrees))
|
||||
}
|
||||
|
||||
for idx, at := range actual.Trees {
|
||||
for idx, atr := range actual.Trees {
|
||||
at, ok := atr.(*tree.FileTree)
|
||||
if !ok {
|
||||
t.Fatalf("could not extract tree from reader")
|
||||
}
|
||||
if !at.Equal(c.expectedTrees[idx]) {
|
||||
t.Error("mismatched tree @ idx", idx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user