-
Notifications
You must be signed in to change notification settings - Fork 587
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add h1digest when scanning go.mod (#1405)
Fixes #1277
- Loading branch information
Showing
15 changed files
with
247 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ func TestUnmarshalPackageGolang(t *testing.T) { | |
"language": "go", | ||
"cpes": [], | ||
"purl": "pkg:golang/gopkg.in/square/[email protected]", | ||
"metadataType": "GolangBinMetadata", | ||
"metadataType": "GolangMetadata", | ||
"metadata": { | ||
"goCompiledVersion": "go1.18", | ||
"architecture": "amd64", | ||
|
@@ -43,7 +43,7 @@ func TestUnmarshalPackageGolang(t *testing.T) { | |
}`), | ||
assert: func(p *Package) { | ||
assert.NotNil(t, p.Metadata) | ||
golangMetadata := p.Metadata.(pkg.GolangBinMetadata) | ||
golangMetadata := p.Metadata.(pkg.GolangMetadata) | ||
assert.NotEmpty(t, golangMetadata) | ||
assert.Equal(t, "go1.18", golangMetadata.GoCompiledVersion) | ||
}, | ||
|
@@ -93,7 +93,7 @@ func Test_unpackMetadata(t *testing.T) { | |
}{ | ||
{ | ||
name: "unmarshal package metadata", | ||
metadataType: pkg.GolangBinMetadataType, | ||
metadataType: pkg.GolangMetadataType, | ||
packageData: []byte(`{ | ||
"id": "8b594519bc23da50", | ||
"name": "gopkg.in/square/go-jose.v2", | ||
|
@@ -109,7 +109,7 @@ func Test_unpackMetadata(t *testing.T) { | |
"language": "go", | ||
"cpes": [], | ||
"purl": "pkg:golang/gopkg.in/square/[email protected]", | ||
"metadataType": "GolangBinMetadata", | ||
"metadataType": "GolangMetadata", | ||
"metadata": { | ||
"goCompiledVersion": "go1.18", | ||
"architecture": "amd64", | ||
|
@@ -214,11 +214,19 @@ func Test_unpackMetadata(t *testing.T) { | |
}, | ||
{ | ||
name: "can handle package with metadata type but missing metadata", | ||
packageData: []byte(`{ | ||
"metadataType": "GolangMetadata" | ||
}`), | ||
metadataType: pkg.GolangMetadataType, | ||
wantMetadata: pkg.GolangMetadata{}, | ||
}, | ||
{ | ||
name: "can handle package with golang bin metadata type", | ||
packageData: []byte(`{ | ||
"metadataType": "GolangBinMetadata" | ||
}`), | ||
metadataType: pkg.GolangBinMetadataType, | ||
wantMetadata: pkg.GolangBinMetadata{}, | ||
metadataType: pkg.GolangMetadataType, | ||
wantMetadata: pkg.GolangMetadata{}, | ||
}, | ||
{ | ||
name: "can handle package with unknonwn metadata type and missing metadata", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.