Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo Mame -> Name #1676

Merged
merged 1 commit into from
Aug 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions cmd/pdatagen/internal/base_fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ type baseField interface {
}

type sliceField struct {
fieldMame string
fieldName string
originFieldName string
returnSlice *sliceStruct
}
Expand All @@ -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":
Expand All @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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":
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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":
Expand All @@ -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:
Expand All @@ -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)
12 changes: 6 additions & 6 deletions cmd/pdatagen/internal/common_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var instrumentationLibrary = &messageStruct{
fields: []baseField{
nameField,
&primitiveField{
fieldMame: "Version",
fieldName: "Version",
originFieldName: "Version",
returnType: "string",
defaultVal: `""`,
Expand Down Expand Up @@ -73,7 +73,7 @@ var instrumentationLibraryField = &messageField{
}

var startTimeField = &primitiveTypedField{
fieldMame: "StartTime",
fieldName: "StartTime",
originFieldName: "StartTimeUnixNano",
returnType: "TimestampUnixNano",
rawType: "uint64",
Expand All @@ -82,7 +82,7 @@ var startTimeField = &primitiveTypedField{
}

var timeField = &primitiveTypedField{
fieldMame: "Timestamp",
fieldName: "Timestamp",
originFieldName: "TimeUnixNano",
returnType: "TimestampUnixNano",
rawType: "uint64",
Expand All @@ -91,7 +91,7 @@ var timeField = &primitiveTypedField{
}

var endTimeField = &primitiveTypedField{
fieldMame: "EndTime",
fieldName: "EndTime",
originFieldName: "EndTimeUnixNano",
returnType: "TimestampUnixNano",
rawType: "uint64",
Expand All @@ -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: `""`,
Expand Down
14 changes: 7 additions & 7 deletions cmd/pdatagen/internal/log_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var resourceLogs = &messageStruct{
fields: []baseField{
resourceField,
&sliceField{
fieldMame: "InstrumentationLibraryLogs",
fieldName: "InstrumentationLibraryLogs",
originFieldName: "InstrumentationLibraryLogs",
returnSlice: instrumentationLibraryLogsSlice,
},
Expand All @@ -67,7 +67,7 @@ var instrumentationLibraryLogs = &messageStruct{
fields: []baseField{
instrumentationLibraryField,
&sliceField{
fieldMame: "Logs",
fieldName: "Logs",
originFieldName: "Logs",
returnSlice: logSlice,
},
Expand All @@ -85,7 +85,7 @@ var logRecord = &messageStruct{
originFullName: "otlplogs.LogRecord",
fields: []baseField{
&primitiveTypedField{
fieldMame: "Timestamp",
fieldName: "Timestamp",
originFieldName: "TimeUnixNano",
returnType: "TimestampUnixNano",
rawType: "uint64",
Expand All @@ -95,30 +95,30 @@ var logRecord = &messageStruct{
traceIDField,
spanIDField,
&primitiveTypedField{
fieldMame: "Flags",
fieldName: "Flags",
originFieldName: "Flags",
returnType: "uint32",
rawType: "uint32",
defaultVal: `uint32(0)`,
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",
defaultVal: `SeverityNumberUNDEFINED`,
testVal: `SeverityNumberINFO`,
},
&primitiveField{
fieldMame: "Name",
fieldName: "Name",
originFieldName: "Name",
returnType: "string",
defaultVal: `""`,
Expand Down
Loading