mirror of
https://github.com/anchore/syft.git
synced 2026-11-03 07:56:36 +01:00
improve doc comments
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
@@ -34,7 +34,6 @@ type artifactMetadataUnpacker struct {
|
||||
}
|
||||
|
||||
func NewArtifact(p *pkg.Package) (Artifact, error) {
|
||||
|
||||
return Artifact{
|
||||
artifactBasicMetadata: artifactBasicMetadata{
|
||||
Name: p.Name,
|
||||
@@ -67,6 +66,7 @@ func (a Artifact) ToPackage() pkg.Package {
|
||||
}
|
||||
}
|
||||
|
||||
// nolint:funlen
|
||||
func (a *Artifact) UnmarshalJSON(b []byte) error {
|
||||
var basic artifactBasicMetadata
|
||||
if err := json.Unmarshal(b, &basic); err != nil {
|
||||
@@ -128,7 +128,6 @@ func (a *Artifact) UnmarshalJSON(b []byte) error {
|
||||
// there may be packages with no metadata, which is OK
|
||||
default:
|
||||
return fmt.Errorf("unsupported package metadata type: %+v", a.MetadataType)
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -55,7 +55,6 @@ func (s *Source) UnmarshalJSON(b []byte) error {
|
||||
s.Target = payload
|
||||
default:
|
||||
return fmt.Errorf("unsupported package metadata type: %+v", s.Type)
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"MIT"
|
||||
],
|
||||
"language": "python",
|
||||
"metadataType": "python-package-metadata",
|
||||
"metadataType": "PythonPackageMetadata",
|
||||
"metadata": {
|
||||
"name": "package-1",
|
||||
"version": "1.0.1",
|
||||
@@ -37,7 +37,7 @@
|
||||
],
|
||||
"licenses": null,
|
||||
"language": "",
|
||||
"metadataType": "dpkg-metadata",
|
||||
"metadataType": "DpkgMetadata",
|
||||
"metadata": {
|
||||
"package": "package-2",
|
||||
"source": "",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"MIT"
|
||||
],
|
||||
"language": "python",
|
||||
"metadataType": "python-package-metadata",
|
||||
"metadataType": "PythonPackageMetadata",
|
||||
"metadata": {
|
||||
"name": "package-1",
|
||||
"version": "1.0.1",
|
||||
@@ -39,7 +39,7 @@
|
||||
],
|
||||
"licenses": null,
|
||||
"language": "",
|
||||
"metadataType": "dpkg-metadata",
|
||||
"metadataType": "DpkgMetadata",
|
||||
"metadata": {
|
||||
"package": "package-2",
|
||||
"source": "",
|
||||
|
||||
@@ -10,11 +10,13 @@ import (
|
||||
"github.com/anchore/syft/syft/source"
|
||||
)
|
||||
|
||||
// Presenter is a human-friendly text presenter to represent package and source data.
|
||||
type Presenter struct {
|
||||
catalog *pkg.Catalog
|
||||
srcMetadata source.Metadata
|
||||
}
|
||||
|
||||
// NewPresenter creates a new presenter for the given set of catalog and image data.
|
||||
func NewPresenter(catalog *pkg.Catalog, srcMetadata source.Metadata) *Presenter {
|
||||
return &Presenter{
|
||||
catalog: catalog,
|
||||
|
||||
Reference in New Issue
Block a user