build: go 1.24

We were running behind and there were quite some deprecations to update.
This was mostly in the upstream copy/pasta package but seems quite
minimal.
This commit is contained in:
2025-03-16 12:04:32 +01:00
parent a2b678caf6
commit 1723025fbf
822 changed files with 25433 additions and 197407 deletions

View File

@ -48,7 +48,7 @@ type expoHistogramDataPoint[N int64 | float64] struct {
zeroCount uint64
}
func newExpoHistogramDataPoint[N int64 | float64](attrs attribute.Set, maxSize int, maxScale int32, noMinMax, noSum bool) *expoHistogramDataPoint[N] {
func newExpoHistogramDataPoint[N int64 | float64](attrs attribute.Set, maxSize int, maxScale int32, noMinMax, noSum bool) *expoHistogramDataPoint[N] { // nolint:revive // we need this control flag
f := math.MaxFloat64
ma := N(f) // if N is int64, max will overflow to -9223372036854775808
mi := N(-f)

View File

@ -5,5 +5,5 @@ package metric // import "go.opentelemetry.io/otel/sdk/metric"
// version is the current release version of the metric SDK in use.
func version() string {
return "1.33.0"
return "1.35.0"
}

View File

@ -5,6 +5,7 @@ package resource // import "go.opentelemetry.io/otel/sdk/resource"
import (
"encoding/xml"
"errors"
"fmt"
"io"
"os"
@ -63,7 +64,7 @@ func parsePlistFile(file io.Reader) (map[string]string, error) {
}
if len(v.Dict.Key) != len(v.Dict.String) {
return nil, fmt.Errorf("the number of <key> and <string> elements doesn't match")
return nil, errors.New("the number of <key> and <string> elements doesn't match")
}
properties := make(map[string]string, len(v.Dict.Key))

View File

@ -21,11 +21,22 @@ import (
// Resources should be passed and stored as pointers
// (`*resource.Resource`). The `nil` value is equivalent to an empty
// Resource.
//
// Note that the Go == operator compares not just the resource attributes but
// also all other internals of the Resource type. Therefore, Resource values
// should not be used as map or database keys. In general, the [Resource.Equal]
// method should be used instead of direct comparison with ==, since that
// method ensures the correct comparison of resource attributes, and the
// [attribute.Distinct] returned from [Resource.Equivalent] should be used for
// map and database keys instead.
type Resource struct {
attrs attribute.Set
schemaURL string
}
// Compile-time check that the Resource remains comparable.
var _ map[Resource]struct{} = nil
var (
defaultResource *Resource
defaultResourceOnce sync.Once
@ -137,15 +148,19 @@ func (r *Resource) Iter() attribute.Iterator {
return r.attrs.Iter()
}
// Equal returns true when a Resource is equivalent to this Resource.
func (r *Resource) Equal(eq *Resource) bool {
// Equal returns whether r and o represent the same resource. Two resources can
// be equal even if they have different schema URLs.
//
// See the documentation on the [Resource] type for the pitfalls of using ==
// with Resource values; most code should use Equal instead.
func (r *Resource) Equal(o *Resource) bool {
if r == nil {
r = Empty()
}
if eq == nil {
eq = Empty()
if o == nil {
o = Empty()
}
return r.Equivalent() == eq.Equivalent()
return r.Equivalent() == o.Equivalent()
}
// Merge creates a new [Resource] by merging a and b.

View File

@ -201,10 +201,9 @@ func (bsp *batchSpanProcessor) ForceFlush(ctx context.Context) error {
}
}
wait := make(chan error)
wait := make(chan error, 1)
go func() {
wait <- bsp.exportSpans(ctx)
close(wait)
}()
// Wait until the export is finished or the context is cancelled/timed out
select {

View File

@ -47,12 +47,12 @@ const (
// Drop will not record the span and all attributes/events will be dropped.
Drop SamplingDecision = iota
// Record indicates the span's `IsRecording() == true`, but `Sampled` flag
// *must not* be set.
// RecordOnly indicates the span's IsRecording method returns true, but trace.FlagsSampled flag
// must not be set.
RecordOnly
// RecordAndSample has span's `IsRecording() == true` and `Sampled` flag
// *must* be set.
// RecordAndSample indicates the span's IsRecording method returns true and trace.FlagsSampled flag
// must be set.
RecordAndSample
)

View File

@ -58,7 +58,7 @@ func (ssp *simpleSpanProcessor) Shutdown(ctx context.Context) error {
var err error
ssp.stopOnce.Do(func() {
stopFunc := func(exp SpanExporter) (<-chan error, func()) {
done := make(chan error)
done := make(chan error, 1)
return done, func() { done <- exp.Shutdown(ctx) }
}

View File

@ -5,5 +5,5 @@ package sdk // import "go.opentelemetry.io/otel/sdk"
// Version is the current release version of the OpenTelemetry SDK in use.
func Version() string {
return "1.33.0"
return "1.35.0"
}