diff options
author | Paul Duncan <pabs@pablotron.org> | 2022-02-20 10:33:21 -0500 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2022-02-20 10:33:21 -0500 |
commit | bcfce83f66a04154ad54769b4bf8de21fd425c3f (patch) | |
tree | 624c1139041379757b4eddbea2071e678b6e7456 /feed | |
parent | 52f286cb19f2d4b93a726cfeee4afad0d8bc6b61 (diff) | |
download | cvez-bcfce83f66a04154ad54769b4bf8de21fd425c3f.tar.bz2 cvez-bcfce83f66a04154ad54769b4bf8de21fd425c3f.zip |
feed/score.go: add NewScore() (disabled)
Diffstat (limited to 'feed')
-rw-r--r-- | feed/score.go | 11 |
1 files changed, 11 insertions, 0 deletions
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 |