use zero value for nils in ID generation

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman 2021-11-09 17:26:38 -05:00
parent 1537e73083
commit 2356539ebe
No known key found for this signature in database
GPG Key ID: 5CB45AE22BAB7EA7
2 changed files with 13 additions and 14 deletions

View File

@ -1,7 +1,7 @@
{
"artifacts": [
{
"id": "810333194629225077",
"id": "14696638697550896878",
"name": "package-1",
"version": "1.0.1",
"type": "python",

View File

@ -19,7 +19,6 @@ type Package struct {
Version string // the version of the package
FoundBy string // the specific cataloger that discovered this package
Locations []source.Location // the locations that lead to the discovery of this package (note: this is not necessarily the locations that make up this package)
// TODO: should we move licenses into metadata?
Licenses []string // licenses discovered with the package metadata
Language Language // the language ecosystem this package belongs to (e.g. JavaScript, Python, etc)
Type Type // the package type (e.g. Npm, Yarn, Python, Rpm, Deb, etc)
@ -47,7 +46,7 @@ func (p Package) String() string {
func (p Package) Fingerprint() (string, error) {
f, err := hashstructure.Hash(p, hashstructure.FormatV2, &hashstructure.HashOptions{
//ZeroNil: true,
ZeroNil: true,
SlicesAsSets: true,
})
if err != nil {