Refactoring packages
Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
This commit is contained in:
parent
58cdb88537
commit
0786b2c060
@ -20,10 +20,10 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/coreos/pkg/capnslog"
|
||||
"github.com/coreos/clair/database"
|
||||
"github.com/coreos/clair/utils/types"
|
||||
"github.com/coreos/clair/worker/detectors"
|
||||
"github.com/coreos/pkg/capnslog"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -100,13 +100,7 @@ func (detector *DpkgPackagesDetector) Detect(data map[string][]byte) ([]*databas
|
||||
}
|
||||
}
|
||||
|
||||
// Convert the map to a slice
|
||||
packages := make([]*database.Package, 0, len(packagesMap))
|
||||
for _, pkg := range packagesMap {
|
||||
packages = append(packages, pkg)
|
||||
}
|
||||
|
||||
return packages, nil
|
||||
return mapToSlices(packagesMap), nil
|
||||
}
|
||||
|
||||
// GetRequiredFiles returns the list of files required for Detect, without
|
||||
|
@ -21,8 +21,8 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/coreos/clair/database"
|
||||
cerrors "github.com/coreos/clair/utils/errors"
|
||||
"github.com/coreos/clair/utils"
|
||||
cerrors "github.com/coreos/clair/utils/errors"
|
||||
"github.com/coreos/clair/utils/types"
|
||||
"github.com/coreos/clair/worker/detectors"
|
||||
)
|
||||
@ -96,13 +96,7 @@ func (detector *RpmPackagesDetector) Detect(data map[string][]byte) ([]*database
|
||||
packagesMap[pkg.Key()] = pkg
|
||||
}
|
||||
|
||||
// Convert the map to a slice
|
||||
packages := make([]*database.Package, 0, len(packagesMap))
|
||||
for _, pkg := range packagesMap {
|
||||
packages = append(packages, pkg)
|
||||
}
|
||||
|
||||
return packages, nil
|
||||
return mapToSlices(packagesMap), nil
|
||||
}
|
||||
|
||||
// GetRequiredFiles returns the list of files required for Detect, without
|
||||
|
Loading…
Reference in New Issue
Block a user