diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-01-31 16:45:29 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-01-31 16:45:29 -0500 |
commit | 80407c0ee1ddd7d8d981e9d87139629d924d707e (patch) | |
tree | 6cb729c052bfc4864c3a67d4fdaa1af1b00a7213 | |
parent | 702de7c3eb3fd19f7f7d431100b84db5266a3625 (diff) | |
download | cvez-80407c0ee1ddd7d8d981e9d87139629d924d707e.tar.bz2 cvez-80407c0ee1ddd7d8d981e9d87139629d924d707e.zip |
internal/cvss: clean up comments
-rw-r--r-- | internal/cvss/v30vector.go | 8 | ||||
-rw-r--r-- | internal/cvss/v31vector.go | 7 |
2 files changed, 8 insertions, 7 deletions
diff --git a/internal/cvss/v30vector.go b/internal/cvss/v30vector.go index 951cd03..0d835a0 100644 --- a/internal/cvss/v30vector.go +++ b/internal/cvss/v30vector.go @@ -44,22 +44,22 @@ func (v v30Vector) Metrics() []Metric { // Create CVSS 3.0 vector from string. func newV30Vector(s string) (Vector, error) { + // strip version prefix, split into metric strings strs := strings.Split(s[len(v31Prefix):], "/") r := make([]v3Metric, len(strs)) - // walk metric strings + // build results for i, ms := range(strs) { - // convert metric string to metric + // get metric from string m, err := getV3Metric(V30, ms) if err != nil { return nil, err } - // add to results r[i] = m } - // build and return vector + // return result return v30Vector(r), nil } diff --git a/internal/cvss/v31vector.go b/internal/cvss/v31vector.go index 92fb1e6..6e2acb6 100644 --- a/internal/cvss/v31vector.go +++ b/internal/cvss/v31vector.go @@ -32,7 +32,7 @@ func (v31Vector) Version() Version { // Return metrics in this vector. func (v v31Vector) Metrics() []Metric { - // build result + // build slice of metrics r := make([]Metric, len(v)) for i, m := range(v) { r[i] = m @@ -44,10 +44,11 @@ func (v v31Vector) Metrics() []Metric { // create CVSS 3.1 vector from string. func newV31Vector(s string) (Vector, error) { + // strip version prefix, split into metric strings strs := strings.Split(s[len(v31Prefix):], "/") r := make([]v3Metric, len(strs)) - // walk metric strings + // build results for i, ms := range(strs) { // get metric from string m, err := getV3Metric(V31, ms) @@ -59,7 +60,7 @@ func newV31Vector(s string) (Vector, error) { r[i] = m } - // build and return vector + // return result return v31Vector(r), nil } |