From 389e0ee71258a38abcd1ffcc5716ca79504e3f8d Mon Sep 17 00:00:00 2001 From: Alex Boten <223565+codeboten@users.noreply.github.com> Date: Mon, 9 Dec 2024 10:52:28 -0800 Subject: [PATCH] make linters happy Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com> --- config/v0.2.0/log.go | 2 +- config/v0.2.0/metric.go | 4 ++-- config/v0.2.0/resource.go | 5 +++-- config/v0.2.0/trace.go | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/config/v0.2.0/log.go b/config/v0.2.0/log.go index 2072cdb681e..bd302cfa75a 100644 --- a/config/v0.2.0/log.go +++ b/config/v0.2.0/log.go @@ -61,7 +61,7 @@ func logProcessor(ctx context.Context, processor LogRecordProcessor) (sdklog.Pro } return sdklog.NewSimpleProcessor(exp), nil } - return nil, fmt.Errorf("unsupported log processor type, must be one of simple or batch") + return nil, errors.New("unsupported log processor type, must be one of simple or batch") } func logExporter(ctx context.Context, exporter LogRecordExporter) (sdklog.Exporter, error) { diff --git a/config/v0.2.0/metric.go b/config/v0.2.0/metric.go index c7b374aa53f..458da85f909 100644 --- a/config/v0.2.0/metric.go +++ b/config/v0.2.0/metric.go @@ -264,10 +264,10 @@ func lowMemory(ik sdkmetric.InstrumentKind) metricdata.Temporality { func prometheusReader(ctx context.Context, prometheusConfig *Prometheus) (sdkmetric.Reader, error) { var opts []otelprom.Option if prometheusConfig.Host == nil { - return nil, fmt.Errorf("host must be specified") + return nil, errors.New("host must be specified") } if prometheusConfig.Port == nil { - return nil, fmt.Errorf("port must be specified") + return nil, errors.New("port must be specified") } if prometheusConfig.WithoutScopeInfo != nil && *prometheusConfig.WithoutScopeInfo { opts = append(opts, otelprom.WithoutScopeInfo()) diff --git a/config/v0.2.0/resource.go b/config/v0.2.0/resource.go index 9f01b41b509..7c24e109f72 100644 --- a/config/v0.2.0/resource.go +++ b/config/v0.2.0/resource.go @@ -5,6 +5,7 @@ package config // import "go.opentelemetry.io/contrib/config/v0.2.0" import ( "fmt" + "strconv" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" @@ -17,7 +18,7 @@ func keyVal(k string, v any) attribute.KeyValue { case int64: return attribute.Int64(k, val) case uint64: - return attribute.String(k, fmt.Sprintf("%d", val)) + return attribute.String(k, strconv.FormatUint(val, 10)) case float64: return attribute.Float64(k, val) case int8: @@ -37,7 +38,7 @@ func keyVal(k string, v any) attribute.KeyValue { case int: return attribute.Int(k, val) case uint: - return attribute.String(k, fmt.Sprintf("%d", val)) + return attribute.String(k, strconv.FormatUint(uint64(val), 10)) case string: return attribute.String(k, val) default: diff --git a/config/v0.2.0/trace.go b/config/v0.2.0/trace.go index 07d355de35b..c639c174328 100644 --- a/config/v0.2.0/trace.go +++ b/config/v0.2.0/trace.go @@ -83,7 +83,7 @@ func spanProcessor(ctx context.Context, processor SpanProcessor) (sdktrace.SpanP } return sdktrace.NewSimpleSpanProcessor(exp), nil } - return nil, fmt.Errorf("unsupported span processor type, must be one of simple or batch") + return nil, errors.New("unsupported span processor type, must be one of simple or batch") } func otlpGRPCSpanExporter(ctx context.Context, otlpConfig *OTLP) (sdktrace.SpanExporter, error) {