Refactoring packages

Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
This commit is contained in:
Nicolas Lamirault 2016-01-05 13:32:19 +01:00
parent 58cdb88537
commit 0786b2c060
2 changed files with 4 additions and 16 deletions

View File

@ -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

View File

@ -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