summaryrefslogtreecommitdiff
path: root/src/idl_gen_go.cpp
diff options
context:
space:
mode:
authorDavid Reiss <davidn@gmail.com>2019-05-20 14:46:36 -0700
committerWouter van Oortmerssen <aardappel@gmail.com>2019-05-20 14:46:36 -0700
commitc5e2d37337c8d84177111629083ec31e974816bd (patch)
tree7d0f735908ac9ede528e092e3ef99b143b2bf682 /src/idl_gen_go.cpp
parentfe83b68ac68f221a8a7cf105e541b6d6d682ad80 (diff)
downloadflatbuffers-c5e2d37337c8d84177111629083ec31e974816bd.tar.gz
flatbuffers-c5e2d37337c8d84177111629083ec31e974816bd.tar.bz2
flatbuffers-c5e2d37337c8d84177111629083ec31e974816bd.zip
[Go] Change two more sites to use enum types (#5359)
Fixes #5357 (regression introduced by #5235)
Diffstat (limited to 'src/idl_gen_go.cpp')
-rw-r--r--src/idl_gen_go.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/idl_gen_go.cpp b/src/idl_gen_go.cpp
index 7987d90a..6556741e 100644
--- a/src/idl_gen_go.cpp
+++ b/src/idl_gen_go.cpp
@@ -497,7 +497,7 @@ class GoGenerator : public BaseGenerator {
std::string &code = *code_ptr;
code += std::string(", ") + nameprefix;
code += GoIdentity(field.name);
- code += " " + GenTypeBasic(field.value.type);
+ code += " " + TypeName(field);
}
}
}
@@ -525,7 +525,7 @@ class GoGenerator : public BaseGenerator {
(nameprefix + (field.name + "_")).c_str(), code_ptr);
} else {
code += "\tbuilder.Prepend" + GenMethod(field) + "(";
- code += nameprefix + GoIdentity(field.name) + ")\n";
+ code += CastToBaseType(field.value.type, nameprefix + GoIdentity(field.name)) + ")\n";
}
}
}
@@ -556,7 +556,7 @@ class GoGenerator : public BaseGenerator {
if (!IsScalar(field.value.type.base_type) && (!struct_def.fixed)) {
code += "flatbuffers.UOffsetT";
} else {
- code += GenTypeBasic(field.value.type);
+ code += TypeName(field);
}
code += ") {\n";
code += "\tbuilder.Prepend";
@@ -567,7 +567,7 @@ class GoGenerator : public BaseGenerator {
code += "(";
code += GoIdentity(field.name) + ")";
} else {
- code += GoIdentity(field.name);
+ code += CastToBaseType(field.value.type, GoIdentity(field.name));
}
code += ", " + GenConstant(field);
code += ")\n}\n";