-
-
Notifications
You must be signed in to change notification settings - Fork 936
Open
Description
#709 and #711 introduce inconsistencies that I'd like to address.
- Whilst implementing
it.ModeI noticed that a new slice was being allocated (mode = []T{item}) each time a larger frequency is found. I addressed this by reusing the original slice (mode = append(mode[:0], item)). The issue from @d-enk recommended this change be applied to thelo.Modeslice version but the PR from @intojhanurag did not make this change. - If truncating the capacity of return slices is deemed important (questionable!) then why would we apply it to this particular helper and not the 48 other helpers that return slices?
- There is no advantage to using the more verbose
make([]T, 0)syntax that I'm aware of. See lint: use consistent short slice creation syntax #729.
My preference is to roll back #711 and replace with the simple slice reuse fix mentioned in item 1 above.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels