Skip to content

Commit c414c1c

Browse files
remove trailing '_' if exists
1 parent ae15351 commit c414c1c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
compile:
2-
go install github.com/bitquery/protobuf-sql/cmd/protoc-gen-sql@version-update && \
2+
go install github.com/bitquery/protobuf-sql/cmd/protoc-gen-sql@test/test && \
33
rm -rf ./examples/sql && \
44
mkdir -p ./examples/sql && \
55
protoc \

generators/file_generator.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ func (g *fileGenerator) generateFields(message *protogen.Message, prefix string,
129129
}
130130

131131
if _, ok := g.fieldsToIgnoreMap[fieldName]; !ok {
132+
// remove trailing '_' if exists
133+
if len(fieldName) > 0 && fieldName[len(fieldName)-1] == '_' {
134+
fieldName = fieldName[:len(fieldName)-1]
135+
}
132136
g.fieldsSl = append(g.fieldsSl, field{
133137
fieldName, fType,
134138
})

0 commit comments

Comments
 (0)