Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Passing capacity to make() in place of length. #1276

Merged
merged 2 commits into from Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion trace/lrumap.go
Expand Up @@ -44,7 +44,7 @@ func (lm lruMap) len() int {
}

func (lm lruMap) keys() []interface{} {
keys := make([]interface{}, len(lm.cacheKeys))
keys := make([]interface{}, 0, len(lm.cacheKeys))
for k := range lm.cacheKeys {
keys = append(keys, k)
}
Expand Down
4 changes: 2 additions & 2 deletions trace/trace.go
Expand Up @@ -381,7 +381,7 @@ func (s *span) interfaceArrayToAnnotationArray() []Annotation {
}

func (s *span) lruAttributesToAttributeMap() map[string]interface{} {
attributes := make(map[string]interface{}, s.lruAttributes.len())
attributes := make(map[string]interface{}, 0, s.lruAttributes.len())
for _, key := range s.lruAttributes.keys() {
value, ok := s.lruAttributes.get(key)
if ok {
Expand Down Expand Up @@ -423,7 +423,7 @@ func (s *span) printStringInternal(attributes []Attribute, str string) {
now := time.Now()
var am map[string]interface{}
if len(attributes) != 0 {
am = make(map[string]interface{}, len(attributes))
am = make(map[string]interface{}, 0, len(attributes))
for _, attr := range attributes {
am[attr.key] = attr.value
}
Expand Down