From 06a4cc5f6d5d66061c8f4f254528aec70a016994 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Thu, 3 Feb 2022 08:27:03 -0500 Subject: internal/cpe/binding.go: fix comments --- internal/cpe/binding.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'internal/cpe') diff --git a/internal/cpe/binding.go b/internal/cpe/binding.go index 8c51d7d..f58752e 100644 --- a/internal/cpe/binding.go +++ b/internal/cpe/binding.go @@ -7,7 +7,7 @@ import ( "strings" ) -// Common Platform Enumeration binding. +// CPE 2.3 binding. type Binding struct { Part Part // Part attribute (NISTIR7695 5.3.3.1). Vendor AvString // Vendor attribute (NISTIR7695 5.3.3.2). @@ -22,13 +22,13 @@ type Binding struct { Other AvString // Other attribute (NISTIR7695 5.3.3.11). } -// cpe 2.3 formatted string prefix +// formatted string prefix var cpe23Prefix = "cpe:2.3:" // missing prefix error var missingPrefix = errors.New("missing CPE 2.3 prefix") -// Create CPE 2.3 binding from formatted string. +// Create binding from CPE 2.3 formatted string. func NewBinding(s string) (Binding, error) { // check prefix if s[0:len(cpe23Prefix)] != cpe23Prefix { @@ -77,6 +77,7 @@ func NewBinding(s string) (Binding, error) { }, nil } +// Serialize binding as CPE 2.3 formatted string. func (v Binding) String() string { return cpe23Prefix + strings.Join([]string { v.Part.String(), @@ -93,7 +94,7 @@ func (v Binding) String() string { }, ":") } -// Unmarshal CPE formatted string from JSON string. +// Unmarshal CPE binding from JSON string. func (me *Binding) UnmarshalJSON(b []byte) error { // decode json string var s string @@ -112,7 +113,7 @@ func (me *Binding) UnmarshalJSON(b []byte) error { return nil } -// Marshal CPE formatted string as JSON string. +// Marshal CPE binding as JSON string. func (v Binding) MarshalJSON() ([]byte, error) { return json.Marshal(v.String()) } -- cgit v1.2.3