1
0
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:
Tyler Yahn
2023-10-16 10:02:21 -07:00
committed by GitHub
parent 9900450477
commit 5dff273a1e
73 changed files with 255 additions and 209 deletions
@@ -136,9 +136,11 @@ type clientShim struct {
func (clientShim) Temporality(metric.InstrumentKind) metricdata.Temporality {
return metricdata.CumulativeTemporality
}
func (clientShim) Aggregation(metric.InstrumentKind) metric.Aggregation {
return nil
}
func (clientShim) ForceFlush(ctx context.Context) error {
return ctx.Err()
}
@@ -203,7 +203,7 @@ func TestConfigs(t *testing.T) {
},
asserts: func(t *testing.T, c *Config, grpcOption bool) {
if grpcOption {
//TODO: make sure gRPC's credentials actually works
// TODO: make sure gRPC's credentials actually works
assert.NotNil(t, c.Metrics.GRPCCredentials)
} else {
// nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool.
@@ -38,7 +38,7 @@ import (
var (
// Sat Jan 01 2000 00:00:00 GMT+0000.
start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0))
start = time.Date(2000, time.January, 0o1, 0, 0, 0, 0, time.FixedZone("GMT", 0))
end = start.Add(30 * time.Second)
kvAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{
@@ -40,7 +40,7 @@ type unknownAggT struct {
var (
// Sat Jan 01 2000 00:00:00 GMT+0000.
start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0))
start = time.Date(2000, time.January, 0o1, 0, 0, 0, 0, time.FixedZone("GMT", 0))
end = start.Add(30 * time.Second)
alice = attribute.NewSet(attribute.String("user", "alice"))
@@ -40,9 +40,11 @@ type clientShim struct {
func (clientShim) Temporality(metric.InstrumentKind) metricdata.Temporality {
return metricdata.CumulativeTemporality
}
func (clientShim) Aggregation(metric.InstrumentKind) metric.Aggregation {
return nil
}
func (clientShim) ForceFlush(ctx context.Context) error {
return ctx.Err()
}
@@ -203,7 +203,7 @@ func TestConfigs(t *testing.T) {
},
asserts: func(t *testing.T, c *Config, grpcOption bool) {
if grpcOption {
//TODO: make sure gRPC's credentials actually works
// TODO: make sure gRPC's credentials actually works
assert.NotNil(t, c.Metrics.GRPCCredentials)
} else {
// nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool.
@@ -38,7 +38,7 @@ import (
var (
// Sat Jan 01 2000 00:00:00 GMT+0000.
start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0))
start = time.Date(2000, time.January, 0o1, 0, 0, 0, 0, time.FixedZone("GMT", 0))
end = start.Add(30 * time.Second)
kvAlice = &cpb.KeyValue{Key: "user", Value: &cpb.AnyValue{
@@ -40,7 +40,7 @@ type unknownAggT struct {
var (
// Sat Jan 01 2000 00:00:00 GMT+0000.
start = time.Date(2000, time.January, 01, 0, 0, 0, 0, time.FixedZone("GMT", 0))
start = time.Date(2000, time.January, 0o1, 0, 0, 0, 0, time.FixedZone("GMT", 0))
end = start.Add(30 * time.Second)
alice = attribute.NewSet(attribute.String("user", "alice"))
+2 -4
View File
@@ -24,9 +24,7 @@ import (
tracesdk "go.opentelemetry.io/otel/sdk/trace"
)
var (
errAlreadyStarted = errors.New("already started")
)
var errAlreadyStarted = errors.New("already started")
// Exporter exports trace data in the OTLP wire format.
type Exporter struct {
@@ -55,7 +53,7 @@ func (e *Exporter) ExportSpans(ctx context.Context, ss []tracesdk.ReadOnlySpan)
// Start establishes a connection to the receiving endpoint.
func (e *Exporter) Start(ctx context.Context) error {
var err = errAlreadyStarted
err := errAlreadyStarted
e.startOnce.Do(func() {
e.mu.Lock()
e.started = true
@@ -213,12 +213,14 @@ func TestSpanData(t *testing.T) {
StartTime: startTime,
EndTime: endTime,
Events: []tracesdk.Event{
{Time: startTime,
{
Time: startTime,
Attributes: []attribute.KeyValue{
attribute.Int64("CompressedByteSize", 512),
},
},
{Time: endTime,
{
Time: endTime,
Attributes: []attribute.KeyValue{
attribute.String("EventType", "Recv"),
},
@@ -201,7 +201,7 @@ func TestConfigs(t *testing.T) {
},
asserts: func(t *testing.T, c *Config, grpcOption bool) {
if grpcOption {
//TODO: make sure gRPC's credentials actually works
// TODO: make sure gRPC's credentials actually works
assert.NotNil(t, c.Traces.GRPCCredentials)
} else {
// nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool.
@@ -32,12 +32,10 @@ const (
instrumentationVersion = "0.1.0"
)
var (
tracer = otel.GetTracerProvider().Tracer(
instrumentationName,
trace.WithInstrumentationVersion(instrumentationVersion),
trace.WithSchemaURL(semconv.SchemaURL),
)
var tracer = otel.GetTracerProvider().Tracer(
instrumentationName,
trace.WithInstrumentationVersion(instrumentationVersion),
trace.WithSchemaURL(semconv.SchemaURL),
)
func add(ctx context.Context, x, y int64) int64 {
@@ -201,7 +201,7 @@ func TestConfigs(t *testing.T) {
},
asserts: func(t *testing.T, c *Config, grpcOption bool) {
if grpcOption {
//TODO: make sure gRPC's credentials actually works
// TODO: make sure gRPC's credentials actually works
assert.NotNil(t, c.Traces.GRPCCredentials)
} else {
// nolint:staticcheck // ignoring tlsCert.RootCAs.Subjects is deprecated ERR because cert does not come from SystemCertPool.