summaryrefslogtreecommitdiffstats
path: root/binapigen/binapigen.go
diff options
context:
space:
mode:
authorOndrej Fabry <ofabry@cisco.com>2020-08-28 20:42:20 +0200
committerOndrej Fabry <ofabry@cisco.com>2020-08-28 20:42:20 +0200
commit15c53e7a9da6f61448b77339b5b762ada0050aff (patch)
treed27febeb074d855ace564d09ad609f2556d5e63d /binapigen/binapigen.go
parenta4e8bf2efe9189ce795f87ab07adbb3780d01d7d (diff)
fix(binapigen): Fix name conflict for union field constructors
PROBLEM Issue discovered in flow_types.api on master (20.09-rc0), where generator encountered inconsistent naming for union type Flow, causing name conflicts with their constructors. SOLUTION Previous cases of union types (address, punt) both contain suffix "Union", thus generator now adds "Union" suffix it is not defined. This way we won't break previously generated code for users. Change-Id: Iffadc167774d66d8416fe36485782bb68ca2a70d Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'binapigen/binapigen.go')
-rw-r--r--binapigen/binapigen.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/binapigen/binapigen.go b/binapigen/binapigen.go
index 2dbd661..35a07d0 100644
--- a/binapigen/binapigen.go
+++ b/binapigen/binapigen.go
@@ -271,7 +271,7 @@ func newUnion(gen *Generator, file *File, apitype vppapi.UnionType) *Union {
typ := &Union{
UnionType: apitype,
GoIdent: GoIdent{
- GoName: camelCaseName(apitype.Name),
+ GoName: withSuffix(camelCaseName(apitype.Name), "Union"),
GoImportPath: file.GoImportPath,
},
}