Skip to content

Commit 8fa5f31

Browse files
committed
item.levelOfConcern(): correctly report overflows of 32-bit values
If a `Count32` overflows, its `ToUint64()` method returns `math.MaxUint32, true`. This should always be reported as exclamation points, regardless of the threshold.
1 parent c5ed233 commit 8fa5f31

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sizes/output.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ func (l *item) Footnote(nameStyle NameStyle) string {
174174
// return the string that should be used as its "level of concern" and
175175
// `true`; otherwise, return `"", false`.
176176
func (l *item) levelOfConcern(threshold Threshold) (string, bool) {
177-
value, _ := l.value.ToUint64()
177+
value, overflow := l.value.ToUint64()
178+
if overflow {
179+
return "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", true
180+
}
178181
alert := Threshold(float64(value) / l.scale)
179182
if alert < threshold {
180183
return "", false

0 commit comments

Comments
 (0)