diff --git a/cmd/pdatagen/internal/base_fields.go b/cmd/pdatagen/internal/base_fields.go index 0595701e0c8..ae4dfe978d2 100644 --- a/cmd/pdatagen/internal/base_fields.go +++ b/cmd/pdatagen/internal/base_fields.go @@ -103,7 +103,7 @@ type baseField interface { } type sliceField struct { - fieldMame string + fieldName string originFieldName string returnSlice *sliceStruct } @@ -114,7 +114,7 @@ func (sf *sliceField) generateAccessors(ms *messageStruct, sb *strings.Builder) case "structName": return ms.structName case "fieldName": - return sf.fieldMame + return sf.fieldName case "returnType": return sf.returnSlice.structName case "originFieldName": @@ -131,7 +131,7 @@ func (sf *sliceField) generateAccessorsTest(ms *messageStruct, sb *strings.Build case "structName": return ms.structName case "fieldName": - return sf.fieldMame + return sf.fieldName case "returnType": return sf.returnSlice.structName default: @@ -141,11 +141,11 @@ func (sf *sliceField) generateAccessorsTest(ms *messageStruct, sb *strings.Build } func (sf *sliceField) generateSetWithTestValue(sb *strings.Builder) { - sb.WriteString("\tfillTest" + sf.returnSlice.structName + "(tv." + sf.fieldMame + "())") + sb.WriteString("\tfillTest" + sf.returnSlice.structName + "(tv." + sf.fieldName + "())") } func (sf *sliceField) generateCopyToValue(sb *strings.Builder) { - sb.WriteString("\tms." + sf.fieldMame + "().CopyTo(dest." + sf.fieldMame + "())") + sb.WriteString("\tms." + sf.fieldName + "().CopyTo(dest." + sf.fieldName + "())") } var _ baseField = (*sliceField)(nil) @@ -204,7 +204,7 @@ func (mf *messageField) generateCopyToValue(sb *strings.Builder) { var _ baseField = (*messageField)(nil) type primitiveField struct { - fieldMame string + fieldName string originFieldName string returnType string defaultVal string @@ -217,9 +217,9 @@ func (pf *primitiveField) generateAccessors(ms *messageStruct, sb *strings.Build case "structName": return ms.structName case "fieldName": - return pf.fieldMame + return pf.fieldName case "lowerFieldName": - return strings.ToLower(pf.fieldMame) + return strings.ToLower(pf.fieldName) case "returnType": return pf.returnType case "originFieldName": @@ -238,7 +238,7 @@ func (pf *primitiveField) generateAccessorsTest(ms *messageStruct, sb *strings.B case "defaultVal": return pf.defaultVal case "fieldName": - return pf.fieldMame + return pf.fieldName case "testValue": return pf.testVal default: @@ -248,18 +248,18 @@ func (pf *primitiveField) generateAccessorsTest(ms *messageStruct, sb *strings.B } func (pf *primitiveField) generateSetWithTestValue(sb *strings.Builder) { - sb.WriteString("\ttv.Set" + pf.fieldMame + "(" + pf.testVal + ")") + sb.WriteString("\ttv.Set" + pf.fieldName + "(" + pf.testVal + ")") } func (pf *primitiveField) generateCopyToValue(sb *strings.Builder) { - sb.WriteString("\tdest.Set" + pf.fieldMame + "(ms." + pf.fieldMame + "())") + sb.WriteString("\tdest.Set" + pf.fieldName + "(ms." + pf.fieldName + "())") } var _ baseField = (*primitiveField)(nil) // Types that has defined a custom type (e.g. "type TimestampUnixNano uint64") type primitiveTypedField struct { - fieldMame string + fieldName string originFieldName string returnType string defaultVal string @@ -273,9 +273,9 @@ func (ptf *primitiveTypedField) generateAccessors(ms *messageStruct, sb *strings case "structName": return ms.structName case "fieldName": - return ptf.fieldMame + return ptf.fieldName case "lowerFieldName": - return strings.ToLower(ptf.fieldMame) + return strings.ToLower(ptf.fieldName) case "returnType": return ptf.returnType case "rawType": @@ -296,7 +296,7 @@ func (ptf *primitiveTypedField) generateAccessorsTest(ms *messageStruct, sb *str case "defaultVal": return ptf.defaultVal case "fieldName": - return ptf.fieldMame + return ptf.fieldName case "testValue": return ptf.testVal default: @@ -306,11 +306,11 @@ func (ptf *primitiveTypedField) generateAccessorsTest(ms *messageStruct, sb *str } func (ptf *primitiveTypedField) generateSetWithTestValue(sb *strings.Builder) { - sb.WriteString("\ttv.Set" + ptf.fieldMame + "(" + ptf.testVal + ")") + sb.WriteString("\ttv.Set" + ptf.fieldName + "(" + ptf.testVal + ")") } func (ptf *primitiveTypedField) generateCopyToValue(sb *strings.Builder) { - sb.WriteString("\tdest.Set" + ptf.fieldMame + "(ms." + ptf.fieldMame + "())") + sb.WriteString("\tdest.Set" + ptf.fieldName + "(ms." + ptf.fieldName + "())") } var _ baseField = (*primitiveTypedField)(nil) diff --git a/cmd/pdatagen/internal/common_structs.go b/cmd/pdatagen/internal/common_structs.go index b44553899a8..cadcdf75855 100644 --- a/cmd/pdatagen/internal/common_structs.go +++ b/cmd/pdatagen/internal/common_structs.go @@ -39,7 +39,7 @@ var instrumentationLibrary = &messageStruct{ fields: []baseField{ nameField, &primitiveField{ - fieldMame: "Version", + fieldName: "Version", originFieldName: "Version", returnType: "string", defaultVal: `""`, @@ -73,7 +73,7 @@ var instrumentationLibraryField = &messageField{ } var startTimeField = &primitiveTypedField{ - fieldMame: "StartTime", + fieldName: "StartTime", originFieldName: "StartTimeUnixNano", returnType: "TimestampUnixNano", rawType: "uint64", @@ -82,7 +82,7 @@ var startTimeField = &primitiveTypedField{ } var timeField = &primitiveTypedField{ - fieldMame: "Timestamp", + fieldName: "Timestamp", originFieldName: "TimeUnixNano", returnType: "TimestampUnixNano", rawType: "uint64", @@ -91,7 +91,7 @@ var timeField = &primitiveTypedField{ } var endTimeField = &primitiveTypedField{ - fieldMame: "EndTime", + fieldName: "EndTime", originFieldName: "EndTimeUnixNano", returnType: "TimestampUnixNano", rawType: "uint64", @@ -100,13 +100,13 @@ var endTimeField = &primitiveTypedField{ } var attributes = &sliceField{ - fieldMame: "Attributes", + fieldName: "Attributes", originFieldName: "Attributes", returnSlice: attributeMap, } var nameField = &primitiveField{ - fieldMame: "Name", + fieldName: "Name", originFieldName: "Name", returnType: "string", defaultVal: `""`, diff --git a/cmd/pdatagen/internal/log_structs.go b/cmd/pdatagen/internal/log_structs.go index ee635a0fcea..5b599f8c588 100644 --- a/cmd/pdatagen/internal/log_structs.go +++ b/cmd/pdatagen/internal/log_structs.go @@ -48,7 +48,7 @@ var resourceLogs = &messageStruct{ fields: []baseField{ resourceField, &sliceField{ - fieldMame: "InstrumentationLibraryLogs", + fieldName: "InstrumentationLibraryLogs", originFieldName: "InstrumentationLibraryLogs", returnSlice: instrumentationLibraryLogsSlice, }, @@ -67,7 +67,7 @@ var instrumentationLibraryLogs = &messageStruct{ fields: []baseField{ instrumentationLibraryField, &sliceField{ - fieldMame: "Logs", + fieldName: "Logs", originFieldName: "Logs", returnSlice: logSlice, }, @@ -85,7 +85,7 @@ var logRecord = &messageStruct{ originFullName: "otlplogs.LogRecord", fields: []baseField{ &primitiveTypedField{ - fieldMame: "Timestamp", + fieldName: "Timestamp", originFieldName: "TimeUnixNano", returnType: "TimestampUnixNano", rawType: "uint64", @@ -95,7 +95,7 @@ var logRecord = &messageStruct{ traceIDField, spanIDField, &primitiveTypedField{ - fieldMame: "Flags", + fieldName: "Flags", originFieldName: "Flags", returnType: "uint32", rawType: "uint32", @@ -103,14 +103,14 @@ var logRecord = &messageStruct{ testVal: `uint32(0x01)`, }, &primitiveField{ - fieldMame: "SeverityText", + fieldName: "SeverityText", originFieldName: "SeverityText", returnType: "string", defaultVal: `""`, testVal: `"INFO"`, }, &primitiveTypedField{ - fieldMame: "SeverityNumber", + fieldName: "SeverityNumber", originFieldName: "SeverityNumber", returnType: "SeverityNumber", rawType: "otlplogs.SeverityNumber", @@ -118,7 +118,7 @@ var logRecord = &messageStruct{ testVal: `SeverityNumberINFO`, }, &primitiveField{ - fieldMame: "Name", + fieldName: "Name", originFieldName: "Name", returnType: "string", defaultVal: `""`, diff --git a/cmd/pdatagen/internal/metrics_structs.go b/cmd/pdatagen/internal/metrics_structs.go index 6078bd159d3..fa84a14cf7b 100644 --- a/cmd/pdatagen/internal/metrics_structs.go +++ b/cmd/pdatagen/internal/metrics_structs.go @@ -66,7 +66,7 @@ var resourceMetrics = &messageStruct{ fields: []baseField{ resourceField, &sliceField{ - fieldMame: "InstrumentationLibraryMetrics", + fieldName: "InstrumentationLibraryMetrics", originFieldName: "InstrumentationLibraryMetrics", returnSlice: instrumentationLibraryMetricsSlice, }, @@ -85,7 +85,7 @@ var instrumentationLibraryMetrics = &messageStruct{ fields: []baseField{ instrumentationLibraryField, &sliceField{ - fieldMame: "Metrics", + fieldName: "Metrics", originFieldName: "Metrics", returnSlice: metricSlice, }, @@ -105,14 +105,14 @@ var metric = &messageStruct{ fields: []baseField{ nameField, &primitiveField{ - fieldMame: "Description", + fieldName: "Description", originFieldName: "Description", returnType: "string", defaultVal: `""`, testVal: `"test_description"`, }, &primitiveField{ - fieldMame: "Unit", + fieldName: "Unit", originFieldName: "Unit", returnType: "string", defaultVal: `""`, @@ -127,7 +127,7 @@ var intGauge = &messageStruct{ originFullName: "otlpmetrics.IntGauge", fields: []baseField{ &sliceField{ - fieldMame: "DataPoints", + fieldName: "DataPoints", originFieldName: "DataPoints", returnSlice: intDataPointSlice, }, @@ -140,7 +140,7 @@ var doubleGauge = &messageStruct{ originFullName: "otlpmetrics.DoubleGauge", fields: []baseField{ &sliceField{ - fieldMame: "DataPoints", + fieldName: "DataPoints", originFieldName: "DataPoints", returnSlice: doubleDataPointSlice, }, @@ -155,7 +155,7 @@ var intSum = &messageStruct{ aggregationTemporalityField, isMonotonicField, &sliceField{ - fieldMame: "DataPoints", + fieldName: "DataPoints", originFieldName: "DataPoints", returnSlice: intDataPointSlice, }, @@ -170,7 +170,7 @@ var doubleSum = &messageStruct{ aggregationTemporalityField, isMonotonicField, &sliceField{ - fieldMame: "DataPoints", + fieldName: "DataPoints", originFieldName: "DataPoints", returnSlice: doubleDataPointSlice, }, @@ -184,7 +184,7 @@ var intHistogram = &messageStruct{ fields: []baseField{ aggregationTemporalityField, &sliceField{ - fieldMame: "DataPoints", + fieldName: "DataPoints", originFieldName: "DataPoints", returnSlice: intHistogramDataPointSlice, }, @@ -198,7 +198,7 @@ var doubleHistogram = &messageStruct{ fields: []baseField{ aggregationTemporalityField, &sliceField{ - fieldMame: "DataPoints", + fieldName: "DataPoints", originFieldName: "DataPoints", returnSlice: doubleHistogramDataPointSlice, }, @@ -299,7 +299,7 @@ var intExemplar = &messageStruct{ timeField, valueInt64Field, &sliceField{ - fieldMame: "FilteredLabels", + fieldName: "FilteredLabels", originFieldName: "FilteredLabels", returnSlice: stringMap, }, @@ -322,7 +322,7 @@ var doubleExemplar = &messageStruct{ timeField, valueFloat64Field, &sliceField{ - fieldMame: "FilteredLabels", + fieldName: "FilteredLabels", originFieldName: "FilteredLabels", returnSlice: stringMap, }, @@ -330,25 +330,25 @@ var doubleExemplar = &messageStruct{ } var labelsField = &sliceField{ - fieldMame: "LabelsMap", + fieldName: "LabelsMap", originFieldName: "Labels", returnSlice: stringMap, } var intExemplarsField = &sliceField{ - fieldMame: "Exemplars", + fieldName: "Exemplars", originFieldName: "Exemplars", returnSlice: intExemplarSlice, } var doubleExemplarsField = &sliceField{ - fieldMame: "Exemplars", + fieldName: "Exemplars", originFieldName: "Exemplars", returnSlice: doubleExemplarSlice, } var countField = &primitiveField{ - fieldMame: "Count", + fieldName: "Count", originFieldName: "Count", returnType: "uint64", defaultVal: "uint64(0)", @@ -356,7 +356,7 @@ var countField = &primitiveField{ } var intSumField = &primitiveField{ - fieldMame: "Sum", + fieldName: "Sum", originFieldName: "Sum", returnType: "int64", defaultVal: "int64(0.0)", @@ -364,7 +364,7 @@ var intSumField = &primitiveField{ } var doubleSumField = &primitiveField{ - fieldMame: "Sum", + fieldName: "Sum", originFieldName: "Sum", returnType: "float64", defaultVal: "float64(0.0)", @@ -372,7 +372,7 @@ var doubleSumField = &primitiveField{ } var valueInt64Field = &primitiveField{ - fieldMame: "Value", + fieldName: "Value", originFieldName: "Value", returnType: "int64", defaultVal: "int64(0)", @@ -380,7 +380,7 @@ var valueInt64Field = &primitiveField{ } var valueFloat64Field = &primitiveField{ - fieldMame: "Value", + fieldName: "Value", originFieldName: "Value", returnType: "float64", defaultVal: "float64(0.0)", @@ -388,7 +388,7 @@ var valueFloat64Field = &primitiveField{ } var bucketCountsField = &primitiveField{ - fieldMame: "BucketCounts", + fieldName: "BucketCounts", originFieldName: "BucketCounts", returnType: "[]uint64", defaultVal: "[]uint64(nil)", @@ -396,7 +396,7 @@ var bucketCountsField = &primitiveField{ } var explicitBoundsField = &primitiveField{ - fieldMame: "ExplicitBounds", + fieldName: "ExplicitBounds", originFieldName: "ExplicitBounds", returnType: "[]float64", defaultVal: "[]float64(nil)", @@ -404,7 +404,7 @@ var explicitBoundsField = &primitiveField{ } var isMonotonicField = &primitiveField{ - fieldMame: "IsMonotonic", + fieldName: "IsMonotonic", originFieldName: "IsMonotonic", returnType: "bool", defaultVal: "false", @@ -412,7 +412,7 @@ var isMonotonicField = &primitiveField{ } var aggregationTemporalityField = &primitiveTypedField{ - fieldMame: "AggregationTemporality", + fieldName: "AggregationTemporality", originFieldName: "AggregationTemporality", returnType: "AggregationTemporality", rawType: "otlpmetrics.AggregationTemporality", diff --git a/cmd/pdatagen/internal/trace_structs.go b/cmd/pdatagen/internal/trace_structs.go index 7577c161863..16017c61c3d 100644 --- a/cmd/pdatagen/internal/trace_structs.go +++ b/cmd/pdatagen/internal/trace_structs.go @@ -53,7 +53,7 @@ var resourceSpans = &messageStruct{ fields: []baseField{ resourceField, &sliceField{ - fieldMame: "InstrumentationLibrarySpans", + fieldName: "InstrumentationLibrarySpans", originFieldName: "InstrumentationLibrarySpans", returnSlice: instrumentationLibrarySpansSlice, }, @@ -72,7 +72,7 @@ var instrumentationLibrarySpans = &messageStruct{ fields: []baseField{ instrumentationLibraryField, &sliceField{ - fieldMame: "Spans", + fieldName: "Spans", originFieldName: "Spans", returnSlice: spanSlice, }, @@ -96,7 +96,7 @@ var span = &messageStruct{ parentSpanIDField, nameField, &primitiveTypedField{ - fieldMame: "Kind", + fieldName: "Kind", originFieldName: "Kind", returnType: "SpanKind", rawType: "otlptrace.Span_SpanKind", @@ -108,24 +108,24 @@ var span = &messageStruct{ attributes, droppedAttributesCount, &sliceField{ - fieldMame: "Events", + fieldName: "Events", originFieldName: "Events", returnSlice: spanEventSlice, }, &primitiveField{ - fieldMame: "DroppedEventsCount", + fieldName: "DroppedEventsCount", originFieldName: "DroppedEventsCount", returnType: "uint32", defaultVal: "uint32(0)", testVal: "uint32(17)", }, &sliceField{ - fieldMame: "Links", + fieldName: "Links", originFieldName: "Links", returnSlice: spanLinkSlice, }, &primitiveField{ - fieldMame: "DroppedLinksCount", + fieldName: "DroppedLinksCount", originFieldName: "DroppedLinksCount", returnType: "uint32", defaultVal: "uint32(0)", @@ -183,7 +183,7 @@ var spanStatus = &messageStruct{ originFullName: "otlptrace.Status", fields: []baseField{ &primitiveTypedField{ - fieldMame: "Code", + fieldName: "Code", originFieldName: "Code", returnType: "StatusCode", rawType: "otlptrace.Status_StatusCode", @@ -191,7 +191,7 @@ var spanStatus = &messageStruct{ testVal: "StatusCode(1)", }, &primitiveField{ - fieldMame: "Message", + fieldName: "Message", originFieldName: "Message", returnType: "string", defaultVal: `""`, @@ -201,7 +201,7 @@ var spanStatus = &messageStruct{ } var traceIDField = &primitiveTypedField{ - fieldMame: "TraceID", + fieldName: "TraceID", originFieldName: "TraceId", returnType: "TraceID", rawType: "[]byte", @@ -210,7 +210,7 @@ var traceIDField = &primitiveTypedField{ } var spanIDField = &primitiveTypedField{ - fieldMame: "SpanID", + fieldName: "SpanID", originFieldName: "SpanId", returnType: "SpanID", rawType: "[]byte", @@ -219,7 +219,7 @@ var spanIDField = &primitiveTypedField{ } var parentSpanIDField = &primitiveTypedField{ - fieldMame: "ParentSpanID", + fieldName: "ParentSpanID", originFieldName: "ParentSpanId", returnType: "SpanID", rawType: "[]byte", @@ -228,7 +228,7 @@ var parentSpanIDField = &primitiveTypedField{ } var traceStateField = &primitiveTypedField{ - fieldMame: "TraceState", + fieldName: "TraceState", originFieldName: "TraceState", returnType: "TraceState", rawType: "string", @@ -237,7 +237,7 @@ var traceStateField = &primitiveTypedField{ } var droppedAttributesCount = &primitiveField{ - fieldMame: "DroppedAttributesCount", + fieldName: "DroppedAttributesCount", originFieldName: "DroppedAttributesCount", returnType: "uint32", defaultVal: "uint32(0)",