Skip to content

Commit

Permalink
refactor: run gofmt across all files
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Nov 5, 2024
1 parent d99d25f commit 00dce02
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 63 deletions.
4 changes: 2 additions & 2 deletions converter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func ToSPDX23(r *scalibr.ScanResult, c SPDXConfig) *v2_3.Document {
IsFilesAnalyzedTagPresent: false,
PackageSourceInfo: pSourceInfo,
PackageExternalReferences: []*v2_3.PackageExternalReference{
&v2_3.PackageExternalReference{
{
Category: "PACKAGE-MANAGER",
RefType: "purl",
Locator: p.String(),
Expand Down Expand Up @@ -138,7 +138,7 @@ func ToSPDX23(r *scalibr.ScanResult, c SPDXConfig) *v2_3.Document {
namespace = "https://spdx.google/" + uuid.New().String()
}
creators := []common.Creator{
common.Creator{
{
CreatorType: "Tool",
Creator: "SCALIBR",
},
Expand Down
86 changes: 43 additions & 43 deletions converter/converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestToSPDX23(t *testing.T) {
{
desc: "Package with no custom config",
scanResult: &scalibr.ScanResult{
Inventories: []*extractor.Inventory{&extractor.Inventory{
Inventories: []*extractor.Inventory{{
Name: "software", Version: "1.2.3", Extractor: pipEx,
}},
},
Expand All @@ -59,14 +59,14 @@ func TestToSPDX23(t *testing.T) {
DocumentNamespace: "https://spdx.google/81855ad8-681d-4d86-91e9-1e00167939cb",
CreationInfo: &v2_3.CreationInfo{
Creators: []common.Creator{
common.Creator{
{
CreatorType: "Tool",
Creator: "SCALIBR",
},
},
},
Packages: []*v2_3.Package{
&v2_3.Package{
{
PackageName: "main",
PackageSPDXIdentifier: "SPDXRef-Package-main-52fdfc07-2182-454f-963f-5f0f9a621d72",
PackageVersion: "0",
Expand All @@ -77,7 +77,7 @@ func TestToSPDX23(t *testing.T) {
PackageDownloadLocation: converter.NoAssertion,
IsFilesAnalyzedTagPresent: false,
},
&v2_3.Package{
{
PackageName: "software",
PackageSPDXIdentifier: "SPDXRef-Package-software-9566c74d-1003-4c4d-bbbb-0407d1e2c649",
PackageVersion: "1.2.3",
Expand All @@ -89,7 +89,7 @@ func TestToSPDX23(t *testing.T) {
IsFilesAnalyzedTagPresent: false,
PackageSourceInfo: "Identified by the python/wheelegg extractor",
PackageExternalReferences: []*v2_3.PackageExternalReference{
&v2_3.PackageExternalReference{
{
Category: "PACKAGE-MANAGER",
RefType: "purl",
Locator: "pkg:pypi/[email protected]",
Expand All @@ -98,7 +98,7 @@ func TestToSPDX23(t *testing.T) {
},
},
Relationships: []*v2_3.Relationship{
&v2_3.Relationship{
{
RefA: common.DocElementID{
ElementRefID: "SPDXRef-Package-main-52fdfc07-2182-454f-963f-5f0f9a621d72",
},
Expand All @@ -107,7 +107,7 @@ func TestToSPDX23(t *testing.T) {
},
Relationship: "CONTAINS",
},
&v2_3.Relationship{
{
RefA: common.DocElementID{
ElementRefID: "SPDXRef-Package-software-9566c74d-1003-4c4d-bbbb-0407d1e2c649",
},
Expand All @@ -122,15 +122,15 @@ func TestToSPDX23(t *testing.T) {
{
desc: "Package with custom config",
scanResult: &scalibr.ScanResult{
Inventories: []*extractor.Inventory{&extractor.Inventory{
Inventories: []*extractor.Inventory{{
Name: "software", Version: "1.2.3", Extractor: pipEx,
}},
},
config: converter.SPDXConfig{
DocumentName: "Custom name",
DocumentNamespace: "Custom namespace",
Creators: []common.Creator{
common.Creator{
{
CreatorType: "Person",
Creator: "Custom creator",
},
Expand All @@ -144,18 +144,18 @@ func TestToSPDX23(t *testing.T) {
DocumentNamespace: "Custom namespace",
CreationInfo: &v2_3.CreationInfo{
Creators: []common.Creator{
common.Creator{
{
CreatorType: "Tool",
Creator: "SCALIBR",
},
common.Creator{
{
CreatorType: "Person",
Creator: "Custom creator",
},
},
},
Packages: []*v2_3.Package{
&v2_3.Package{
{
PackageName: "main",
PackageSPDXIdentifier: "SPDXRef-Package-main-6694d2c4-22ac-4208-a007-2939487f6999",
PackageVersion: "0",
Expand All @@ -166,7 +166,7 @@ func TestToSPDX23(t *testing.T) {
PackageDownloadLocation: converter.NoAssertion,
IsFilesAnalyzedTagPresent: false,
},
&v2_3.Package{
{
PackageName: "software",
PackageSPDXIdentifier: "SPDXRef-Package-software-eb9d18a4-4784-445d-87f3-c67cf22746e9",
PackageVersion: "1.2.3",
Expand All @@ -178,7 +178,7 @@ func TestToSPDX23(t *testing.T) {
IsFilesAnalyzedTagPresent: false,
PackageSourceInfo: "Identified by the python/wheelegg extractor",
PackageExternalReferences: []*v2_3.PackageExternalReference{
&v2_3.PackageExternalReference{
{
Category: "PACKAGE-MANAGER",
RefType: "purl",
Locator: "pkg:pypi/[email protected]",
Expand All @@ -187,7 +187,7 @@ func TestToSPDX23(t *testing.T) {
},
},
Relationships: []*v2_3.Relationship{
&v2_3.Relationship{
{
RefA: common.DocElementID{
ElementRefID: "SPDXRef-Package-main-6694d2c4-22ac-4208-a007-2939487f6999",
},
Expand All @@ -196,7 +196,7 @@ func TestToSPDX23(t *testing.T) {
},
Relationship: "CONTAINS",
},
&v2_3.Relationship{
{
RefA: common.DocElementID{
ElementRefID: "SPDXRef-Package-software-eb9d18a4-4784-445d-87f3-c67cf22746e9",
},
Expand All @@ -213,13 +213,13 @@ func TestToSPDX23(t *testing.T) {
scanResult: &scalibr.ScanResult{
Inventories: []*extractor.Inventory{
// PURL field missing
&extractor.Inventory{Extractor: pipEx},
{Extractor: pipEx},
// No name
&extractor.Inventory{
{
Version: "1.2.3", Extractor: pipEx,
},
// No version
&extractor.Inventory{
{
Name: "software", Extractor: pipEx,
},
},
Expand All @@ -232,13 +232,13 @@ func TestToSPDX23(t *testing.T) {
DocumentNamespace: "https://spdx.google/5fb90bad-b37c-4821-b6d9-5526a41a9504",
CreationInfo: &v2_3.CreationInfo{
Creators: []common.Creator{
common.Creator{
{
CreatorType: "Tool",
Creator: "SCALIBR",
},
},
},
Packages: []*v2_3.Package{&v2_3.Package{
Packages: []*v2_3.Package{{
PackageName: "main",
PackageSPDXIdentifier: "SPDXRef-Package-main-95af5a25-3679-41ba-a2ff-6cd471c483f1",
PackageVersion: "0",
Expand All @@ -255,7 +255,7 @@ func TestToSPDX23(t *testing.T) {
{
desc: "Invalid chars in package name replaced",
scanResult: &scalibr.ScanResult{
Inventories: []*extractor.Inventory{&extractor.Inventory{
Inventories: []*extractor.Inventory{{
Name: "softw@re&", Version: "1.2.3", Extractor: pipEx,
}},
},
Expand All @@ -267,14 +267,14 @@ func TestToSPDX23(t *testing.T) {
DocumentNamespace: "https://spdx.google/0f070244-8615-4bda-8831-3f6a8eb668d2",
CreationInfo: &v2_3.CreationInfo{
Creators: []common.Creator{
common.Creator{
{
CreatorType: "Tool",
Creator: "SCALIBR",
},
},
},
Packages: []*v2_3.Package{
&v2_3.Package{
{
PackageName: "main",
PackageSPDXIdentifier: "SPDXRef-Package-main-680b4e7c-8b76-4a1b-9d49-d4955c848621",
PackageVersion: "0",
Expand All @@ -285,7 +285,7 @@ func TestToSPDX23(t *testing.T) {
PackageDownloadLocation: converter.NoAssertion,
IsFilesAnalyzedTagPresent: false,
},
&v2_3.Package{
{
PackageName: "softw@re&",
PackageSPDXIdentifier: "SPDXRef-Package-softw-re--6325253f-ec73-4dd7-a9e2-8bf921119c16",
PackageVersion: "1.2.3",
Expand All @@ -297,7 +297,7 @@ func TestToSPDX23(t *testing.T) {
IsFilesAnalyzedTagPresent: false,
PackageSourceInfo: "Identified by the python/wheelegg extractor",
PackageExternalReferences: []*v2_3.PackageExternalReference{
&v2_3.PackageExternalReference{
{
Category: "PACKAGE-MANAGER",
RefType: "purl",
Locator: "pkg:pypi/softw%40re%[email protected]",
Expand All @@ -306,7 +306,7 @@ func TestToSPDX23(t *testing.T) {
},
},
Relationships: []*v2_3.Relationship{
&v2_3.Relationship{
{
RefA: common.DocElementID{
ElementRefID: "SPDXRef-Package-main-680b4e7c-8b76-4a1b-9d49-d4955c848621",
},
Expand All @@ -315,7 +315,7 @@ func TestToSPDX23(t *testing.T) {
},
Relationship: "CONTAINS",
},
&v2_3.Relationship{
{
RefA: common.DocElementID{
ElementRefID: "SPDXRef-Package-softw-re--6325253f-ec73-4dd7-a9e2-8bf921119c16",
},
Expand All @@ -330,7 +330,7 @@ func TestToSPDX23(t *testing.T) {
{
desc: "One location reported",
scanResult: &scalibr.ScanResult{
Inventories: []*extractor.Inventory{&extractor.Inventory{
Inventories: []*extractor.Inventory{{
Name: "software", Version: "1.2.3", Extractor: pipEx, Locations: []string{"/file1"},
}},
},
Expand All @@ -342,14 +342,14 @@ func TestToSPDX23(t *testing.T) {
DocumentNamespace: "https://spdx.google/6bf84c71-74cb-4476-b64c-c3dbd968b0f7",
CreationInfo: &v2_3.CreationInfo{
Creators: []common.Creator{
common.Creator{
{
CreatorType: "Tool",
Creator: "SCALIBR",
},
},
},
Packages: []*v2_3.Package{
&v2_3.Package{
{
PackageName: "main",
PackageSPDXIdentifier: "SPDXRef-Package-main-0bf50598-7592-4e66-8a5b-df2c7fc48445",
PackageVersion: "0",
Expand All @@ -360,7 +360,7 @@ func TestToSPDX23(t *testing.T) {
PackageDownloadLocation: converter.NoAssertion,
IsFilesAnalyzedTagPresent: false,
},
&v2_3.Package{
{
PackageName: "software",
PackageSPDXIdentifier: "SPDXRef-Package-software-92d2572b-cd06-48d2-96c5-2f5054e2d083",
PackageVersion: "1.2.3",
Expand All @@ -372,7 +372,7 @@ func TestToSPDX23(t *testing.T) {
IsFilesAnalyzedTagPresent: false,
PackageSourceInfo: "Identified by the python/wheelegg extractor from /file1",
PackageExternalReferences: []*v2_3.PackageExternalReference{
&v2_3.PackageExternalReference{
{
Category: "PACKAGE-MANAGER",
RefType: "purl",
Locator: "pkg:pypi/[email protected]",
Expand All @@ -381,7 +381,7 @@ func TestToSPDX23(t *testing.T) {
},
},
Relationships: []*v2_3.Relationship{
&v2_3.Relationship{
{
RefA: common.DocElementID{
ElementRefID: "SPDXRef-Package-main-0bf50598-7592-4e66-8a5b-df2c7fc48445",
},
Expand All @@ -390,7 +390,7 @@ func TestToSPDX23(t *testing.T) {
},
Relationship: "CONTAINS",
},
&v2_3.Relationship{
{
RefA: common.DocElementID{
ElementRefID: "SPDXRef-Package-software-92d2572b-cd06-48d2-96c5-2f5054e2d083",
},
Expand All @@ -405,7 +405,7 @@ func TestToSPDX23(t *testing.T) {
{
desc: "Multiple locations reported",
scanResult: &scalibr.ScanResult{
Inventories: []*extractor.Inventory{&extractor.Inventory{
Inventories: []*extractor.Inventory{{
Name: "software", Version: "1.2.3", Extractor: pipEx, Locations: []string{"/file1", "/file2", "/file3"},
}},
},
Expand All @@ -417,14 +417,14 @@ func TestToSPDX23(t *testing.T) {
DocumentNamespace: "https://spdx.google/255aa5b7-d44b-4c40-b84c-892b9bffd436",
CreationInfo: &v2_3.CreationInfo{
Creators: []common.Creator{
common.Creator{
{
CreatorType: "Tool",
Creator: "SCALIBR",
},
},
},
Packages: []*v2_3.Package{
&v2_3.Package{
{
PackageName: "main",
PackageSPDXIdentifier: "SPDXRef-Package-main-172ed857-94bb-458b-8c3b-525da1786f9f",
PackageVersion: "0",
Expand All @@ -435,7 +435,7 @@ func TestToSPDX23(t *testing.T) {
PackageDownloadLocation: converter.NoAssertion,
IsFilesAnalyzedTagPresent: false,
},
&v2_3.Package{
{
PackageName: "software",
PackageSPDXIdentifier: "SPDXRef-Package-software-ff094279-db19-44eb-97a1-9d0f7bbacbe0",
PackageVersion: "1.2.3",
Expand All @@ -447,7 +447,7 @@ func TestToSPDX23(t *testing.T) {
IsFilesAnalyzedTagPresent: false,
PackageSourceInfo: "Identified by the python/wheelegg extractor from 3 locations, including /file1 and /file2",
PackageExternalReferences: []*v2_3.PackageExternalReference{
&v2_3.PackageExternalReference{
{
Category: "PACKAGE-MANAGER",
RefType: "purl",
Locator: "pkg:pypi/[email protected]",
Expand All @@ -456,7 +456,7 @@ func TestToSPDX23(t *testing.T) {
},
},
Relationships: []*v2_3.Relationship{
&v2_3.Relationship{
{
RefA: common.DocElementID{
ElementRefID: "SPDXRef-Package-main-172ed857-94bb-458b-8c3b-525da1786f9f",
},
Expand All @@ -465,7 +465,7 @@ func TestToSPDX23(t *testing.T) {
},
Relationship: "CONTAINS",
},
&v2_3.Relationship{
{
RefA: common.DocElementID{
ElementRefID: "SPDXRef-Package-software-ff094279-db19-44eb-97a1-9d0f7bbacbe0",
},
Expand Down Expand Up @@ -511,7 +511,7 @@ func TestToCDX(t *testing.T) {
{
desc: "Package with custom config",
scanResult: &scalibr.ScanResult{
Inventories: []*extractor.Inventory{&extractor.Inventory{
Inventories: []*extractor.Inventory{{
Name: "software", Version: "1.2.3", Extractor: pipEx,
}},
},
Expand Down
Loading

0 comments on commit 00dce02

Please sign in to comment.