1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-25 22:41:46 +02:00

Add the golines golangci-lint formatter (#6513)

Ensure consistent line wrapping (<= 120 characters) within the project.
This commit is contained in:
Tyler Yahn
2025-03-30 11:46:44 +01:00
committed by GitHub
parent b59d0591cf
commit 7512a2be2e
96 changed files with 1774 additions and 426 deletions

View File

@@ -33,7 +33,9 @@ const envVarResourceAttributes = "OTEL_RESOURCE_ATTRIBUTES"
var _ Reader = (*reader)(nil)
func (r *reader) aggregation(kind InstrumentKind) Aggregation { // nolint:revive // import-shadow for method scoped by type.
func (r *reader) aggregation(
kind InstrumentKind,
) Aggregation { // nolint:revive // import-shadow for method scoped by type.
return r.aggregationFunc(kind)
}
@@ -148,9 +150,15 @@ func TestWithResource(t *testing.T) {
want: resource.Default(),
},
{
name: "explicit resource",
options: []Option{WithResource(resource.NewSchemaless(attribute.String("rk1", "rv1"), attribute.Int64("rk2", 5)))},
want: mergeResource(t, resource.Environment(), resource.NewSchemaless(attribute.String("rk1", "rv1"), attribute.Int64("rk2", 5))),
name: "explicit resource",
options: []Option{
WithResource(resource.NewSchemaless(attribute.String("rk1", "rv1"), attribute.Int64("rk2", 5))),
},
want: mergeResource(
t,
resource.Environment(),
resource.NewSchemaless(attribute.String("rk1", "rv1"), attribute.Int64("rk2", 5)),
),
},
{
name: "last resource wins",
@@ -158,12 +166,22 @@ func TestWithResource(t *testing.T) {
WithResource(resource.NewSchemaless(attribute.String("rk1", "vk1"), attribute.Int64("rk2", 5))),
WithResource(resource.NewSchemaless(attribute.String("rk3", "rv3"), attribute.Int64("rk4", 10))),
},
want: mergeResource(t, resource.Environment(), resource.NewSchemaless(attribute.String("rk3", "rv3"), attribute.Int64("rk4", 10))),
want: mergeResource(
t,
resource.Environment(),
resource.NewSchemaless(attribute.String("rk3", "rv3"), attribute.Int64("rk4", 10)),
),
},
{
name: "overlapping attributes with environment resource",
options: []Option{WithResource(resource.NewSchemaless(attribute.String("rk1", "rv1"), attribute.Int64("rk5", 10)))},
want: mergeResource(t, resource.Environment(), resource.NewSchemaless(attribute.String("rk1", "rv1"), attribute.Int64("rk5", 10))),
name: "overlapping attributes with environment resource",
options: []Option{
WithResource(resource.NewSchemaless(attribute.String("rk1", "rv1"), attribute.Int64("rk5", 10))),
},
want: mergeResource(
t,
resource.Environment(),
resource.NewSchemaless(attribute.String("rk1", "rv1"), attribute.Int64("rk5", 10)),
),
},
}
for _, tc := range cases {