[Go] Add missing namespace when using Object API (#6633)
authormogemimi <mogemimi@enginetrouble.net>
Mon, 10 May 2021 17:52:10 +0000 (02:52 +0900)
committerGitHub <noreply@github.com>
Mon, 10 May 2021 17:52:10 +0000 (10:52 -0700)
src/idl_gen_go.cpp

index 5dfd8c8..867f402 100644 (file)
@@ -1011,7 +1011,9 @@ class GoGenerator : public BaseGenerator {
                 NativeType(field.value.type) + ", " + length + ")\n";
         code += "\tfor j := 0; j < " + length + "; j++ {\n";
         if (field.value.type.element == BASE_TYPE_STRUCT) {
-          code += "\t\tx := " + field.value.type.struct_def->name + "{}\n";
+          code += "\t\tx := " +
+                  WrapInNameSpaceAndTrack(*field.value.type.struct_def) +
+                  "{}\n";
           code += "\t\trcv." + field_name_camel + "(&x, j)\n";
         }
         code += "\t\tt." + field_name_camel + "[j] = ";