From bcfce83f66a04154ad54769b4bf8de21fd425c3f Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 20 Feb 2022 10:33:21 -0500 Subject: feed/score.go: add NewScore() (disabled) --- feed/score.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/feed/score.go b/feed/score.go index 724e8f0..9a03c50 100644 --- a/feed/score.go +++ b/feed/score.go @@ -10,6 +10,17 @@ import ( // CVSS score type Score uint8 +// // create new score from floating point value. +// func NewScore(v float64) (Score, error) { +// // check score +// if v < 0.0 || v > 10.0 { +// return Score(0), fmt.Errorf("CVSS score out of bounds: %2.1f", v) +// } else { +// // convert to score, return success +// return Score(uint8(math.Trunc(10.0 * v))), nil +// } +// } + // Unmarshal CVSS score from JSON. func (me *Score) UnmarshalJSON(b []byte) error { // decode float, check for error -- cgit v1.2.3