diff options
Diffstat (limited to 'internal/feed/score.go')
-rw-r--r-- | internal/feed/score.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/feed/score.go b/internal/feed/score.go index 4e7da57..051522f 100644 --- a/internal/feed/score.go +++ b/internal/feed/score.go @@ -8,12 +8,12 @@ import ( ) // CVSS score -type Score float32 +type Score uint8 // Unmarshal CVSS score from JSON. func (me *Score) UnmarshalJSON(b []byte) error { // decode float, check for error - var v float32 + var v float64 if err := json.Unmarshal(b, &v); err != nil { return err } @@ -24,11 +24,11 @@ func (me *Score) UnmarshalJSON(b []byte) error { } // save result, return success - *me = Score(v) + *me = Score(uint8(math.Trunc(10.0 * v))) return nil } func (me Score) String() string { - val := math.Trunc(10.0 * float64(me)) / 10.0 + val := float64(me) / 10.0 return strconv.FormatFloat(val, 'f', 1, 64) } |