Skip to content

Commit

Permalink
go1.20 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
lizthegrey committed Jan 9, 2024
1 parent 50e4fa1 commit 9fb618c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sdk/trace/span.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ func (s *recordingSpan) addOverCapAttrs(limit int, attrs []attribute.KeyValue) {

// Now that s.attributes is deduplicated, adding unique attributes up to
// the capacity of s will not over allocate s.attributes.
s.attributes = slices.Grow(s.attributes, max(0, limit-len(s.attributes)))
if limit-len(s.attributes) > 0 {
s.attributes = slices.Grow(s.attributes, limit-len(s.attributes))
}
for _, a := range attrs {
if !a.Valid() {
// Drop all invalid attributes.
Expand Down

0 comments on commit 9fb618c

Please sign in to comment.