You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2026-06-03 18:35:08 +02:00
Use gofumpt instead of gofmt (#4623)
* Use gofumpt instead of gofmt in golangci-lint conf * Run gofumpt fixes * Format generated templates --------- Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
This commit is contained in:
@@ -56,7 +56,6 @@ func TestConvertMetrics(t *testing.T) {
|
||||
},
|
||||
TimeSeries: []*ocmetricdata.TimeSeries{
|
||||
{
|
||||
|
||||
LabelValues: []ocmetricdata.LabelValue{
|
||||
{
|
||||
Value: "hello",
|
||||
@@ -370,7 +369,8 @@ func TestConvertMetrics(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}, {
|
||||
},
|
||||
{
|
||||
desc: "histogram without data points",
|
||||
input: []*ocmetricdata.Metric{
|
||||
{
|
||||
@@ -393,7 +393,8 @@ func TestConvertMetrics(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}, {
|
||||
},
|
||||
{
|
||||
desc: "sum without data points",
|
||||
input: []*ocmetricdata.Metric{
|
||||
{
|
||||
@@ -417,7 +418,8 @@ func TestConvertMetrics(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}, {
|
||||
},
|
||||
{
|
||||
desc: "gauge without data points",
|
||||
input: []*ocmetricdata.Metric{
|
||||
{
|
||||
@@ -439,7 +441,8 @@ func TestConvertMetrics(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
}, {
|
||||
},
|
||||
{
|
||||
desc: "histogram with negative count",
|
||||
input: []*ocmetricdata.Metric{
|
||||
{
|
||||
@@ -462,7 +465,8 @@ func TestConvertMetrics(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expectedErr: errNegativeDistributionCount,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
desc: "histogram with negative bucket count",
|
||||
input: []*ocmetricdata.Metric{
|
||||
{
|
||||
@@ -489,7 +493,8 @@ func TestConvertMetrics(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expectedErr: errNegativeBucketCount,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
desc: "histogram with non-histogram datapoint type",
|
||||
input: []*ocmetricdata.Metric{
|
||||
{
|
||||
@@ -510,7 +515,8 @@ func TestConvertMetrics(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expectedErr: errMismatchedValueTypes,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
desc: "sum with non-sum datapoint type",
|
||||
input: []*ocmetricdata.Metric{
|
||||
{
|
||||
@@ -531,7 +537,8 @@ func TestConvertMetrics(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expectedErr: errMismatchedValueTypes,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
desc: "gauge with non-gauge datapoint type",
|
||||
input: []*ocmetricdata.Metric{
|
||||
{
|
||||
@@ -552,7 +559,8 @@ func TestConvertMetrics(t *testing.T) {
|
||||
},
|
||||
},
|
||||
expectedErr: errMismatchedValueTypes,
|
||||
}, {
|
||||
},
|
||||
{
|
||||
desc: "unsupported Gauge Distribution type",
|
||||
input: []*ocmetricdata.Metric{
|
||||
{
|
||||
|
||||
@@ -317,8 +317,10 @@ type BridgeTracer struct {
|
||||
propagator propagation.TextMapPropagator
|
||||
}
|
||||
|
||||
var _ ot.Tracer = &BridgeTracer{}
|
||||
var _ ot.TracerContextWithSpanExtension = &BridgeTracer{}
|
||||
var (
|
||||
_ ot.Tracer = &BridgeTracer{}
|
||||
_ ot.TracerContextWithSpanExtension = &BridgeTracer{}
|
||||
)
|
||||
|
||||
// NewBridgeTracer creates a new BridgeTracer. The new tracer forwards
|
||||
// the calls to the OpenTelemetry Noop tracer, so it should be
|
||||
@@ -829,15 +831,13 @@ func newTextMapWrapperForInject(carrier interface{}) (*textMapWrapper, error) {
|
||||
return t, nil
|
||||
}
|
||||
|
||||
type textMapWriter struct {
|
||||
}
|
||||
type textMapWriter struct{}
|
||||
|
||||
func (t *textMapWriter) Set(key string, value string) {
|
||||
// maybe print a warning log.
|
||||
}
|
||||
|
||||
type textMapReader struct {
|
||||
}
|
||||
type textMapReader struct{}
|
||||
|
||||
func (t *textMapReader) ForeachKey(handler func(key, val string) error) error {
|
||||
return nil // maybe print a warning log.
|
||||
|
||||
@@ -35,8 +35,7 @@ import (
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
type testOnlyTextMapReader struct {
|
||||
}
|
||||
type testOnlyTextMapReader struct{}
|
||||
|
||||
func newTestOnlyTextMapReader() *testOnlyTextMapReader {
|
||||
return &testOnlyTextMapReader{}
|
||||
@@ -144,8 +143,7 @@ var (
|
||||
spanID trace.SpanID = [8]byte{byte(11)}
|
||||
)
|
||||
|
||||
type testTextMapPropagator struct {
|
||||
}
|
||||
type testTextMapPropagator struct{}
|
||||
|
||||
func (t testTextMapPropagator) Inject(ctx context.Context, carrier propagation.TextMapCarrier) {
|
||||
carrier.Set(testHeader, strings.Join([]string{traceID.String(), spanID.String()}, ":"))
|
||||
@@ -163,7 +161,7 @@ func (t testTextMapPropagator) Extract(ctx context.Context, carrier propagation.
|
||||
return ctx
|
||||
}
|
||||
|
||||
var exist = false
|
||||
exist := false
|
||||
|
||||
for _, key := range carrier.Keys() {
|
||||
if strings.EqualFold(testHeader, key) {
|
||||
|
||||
@@ -54,8 +54,10 @@ type MockTracer struct {
|
||||
rand *rand.Rand
|
||||
}
|
||||
|
||||
var _ trace.Tracer = &MockTracer{}
|
||||
var _ migration.DeferredContextSetupTracerExtension = &MockTracer{}
|
||||
var (
|
||||
_ trace.Tracer = &MockTracer{}
|
||||
_ migration.DeferredContextSetupTracerExtension = &MockTracer{}
|
||||
)
|
||||
|
||||
func NewMockTracer() *MockTracer {
|
||||
return &MockTracer{
|
||||
@@ -195,8 +197,10 @@ type MockSpan struct {
|
||||
Events []MockEvent
|
||||
}
|
||||
|
||||
var _ trace.Span = &MockSpan{}
|
||||
var _ migration.OverrideTracerSpanExtension = &MockSpan{}
|
||||
var (
|
||||
_ trace.Span = &MockSpan{}
|
||||
_ migration.OverrideTracerSpanExtension = &MockSpan{}
|
||||
)
|
||||
|
||||
func (s *MockSpan) SpanContext() trace.SpanContext {
|
||||
return s.spanContext
|
||||
|
||||
@@ -38,12 +38,15 @@ type testGRPCServer struct{}
|
||||
func (*testGRPCServer) UnaryCall(ctx context.Context, r *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
|
||||
return &testpb.SimpleResponse{Payload: r.Payload * 2}, nil
|
||||
}
|
||||
|
||||
func (*testGRPCServer) StreamingOutputCall(*testpb.SimpleRequest, testpb.TestService_StreamingOutputCallServer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (*testGRPCServer) StreamingInputCall(testpb.TestService_StreamingInputCallServer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (*testGRPCServer) StreamingBidirectionalCall(testpb.TestService_StreamingBidirectionalCallServer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -60,8 +60,10 @@ type WrapperTracer struct {
|
||||
tracer trace.Tracer
|
||||
}
|
||||
|
||||
var _ trace.Tracer = &WrapperTracer{}
|
||||
var _ migration.DeferredContextSetupTracerExtension = &WrapperTracer{}
|
||||
var (
|
||||
_ trace.Tracer = &WrapperTracer{}
|
||||
_ migration.DeferredContextSetupTracerExtension = &WrapperTracer{}
|
||||
)
|
||||
|
||||
// NewWrapperTracer wraps the passed tracer and also talks to the
|
||||
// passed bridge tracer when setting up the context with the new
|
||||
|
||||
Reference in New Issue
Block a user