diff options
Diffstat (limited to 'internal/cvss/v31vector.go')
-rw-r--r-- | internal/cvss/v31vector.go | 7 |
1 files changed, 4 insertions, 3 deletions
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 } |