File tree Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -375,6 +375,8 @@ func purlType(t string) string {
375375 return packageurl .TypeConan
376376 case ftypes .Pub :
377377 return TypeDart // TODO: replace with packageurl.TypeDart once they add it.
378+ case ftypes .RustBinary , ftypes .Cargo :
379+ return packageurl .TypeCargo
378380 case os .Alpine :
379381 return TypeAPK
380382 case os .Debian , os .Ubuntu :
Original file line number Diff line number Diff line change @@ -185,10 +185,15 @@ func TestNewPackageURL(t *testing.T) {
185185 name : "hex package" ,
186186 typ : ftypes .Hex ,
187187 pkg : ftypes.Package {
188- ID : "bunt@0.2.0" ,
189- Name : "bunt" ,
190- Version : "0.2.0" ,
191- Locations : []ftypes.Location {{StartLine : 2 , EndLine : 2 }},
188+ ID : "bunt@0.2.0" ,
189+ Name : "bunt" ,
190+ Version : "0.2.0" ,
191+ Locations : []ftypes.Location {
192+ {
193+ StartLine : 2 ,
194+ EndLine : 2 ,
195+ },
196+ },
192197 },
193198 want : purl.PackageURL {
194199 PackageURL : packageurl.PackageURL {
@@ -247,6 +252,22 @@ func TestNewPackageURL(t *testing.T) {
247252 },
248253 },
249254 },
255+ {
256+ name : "rust binary" ,
257+ typ : ftypes .RustBinary ,
258+ pkg : ftypes.Package {
259+ ID : "abomonation@0.7.3" ,
260+ Name : "abomonation" ,
261+ Version : "0.7.3" ,
262+ },
263+ want : purl.PackageURL {
264+ PackageURL : packageurl.PackageURL {
265+ Type : packageurl .TypeCargo ,
266+ Name : "abomonation" ,
267+ Version : "0.7.3" ,
268+ },
269+ },
270+ },
250271 {
251272 name : "os package" ,
252273 typ : os .RedHat ,
You can’t perform that action at this time.
0 commit comments