Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
b56d60f0
Commit
b56d60f0
authored
May 13, 2019
by
iceboy
Committed by
Wouter van Oortmerssen
May 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Go] Generate imports with fixed order (#5340)
* use fixed order for golang imports * grumble
parent
bff7ffbc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
idl.h
include/flatbuffers/idl.h
+9
-0
idl_gen_go.cpp
src/idl_gen_go.cpp
+7
-1
No files found.
include/flatbuffers/idl.h
View file @
b56d60f0
...
...
@@ -231,6 +231,15 @@ struct Namespace {
size_t
from_table
;
// Part of the namespace corresponds to a message/table.
};
inline
bool
operator
<
(
const
Namespace
&
a
,
const
Namespace
&
b
)
{
size_t
min_size
=
std
::
min
(
a
.
components
.
size
(),
b
.
components
.
size
());
for
(
size_t
i
=
0
;
i
<
min_size
;
++
i
)
{
if
(
a
.
components
[
i
]
!=
b
.
components
[
i
])
return
a
.
components
[
i
]
<
b
.
components
[
i
];
}
return
a
.
components
.
size
()
<
b
.
components
.
size
();
}
// Base class for all definition types (fields, structs_, enums_).
struct
Definition
{
Definition
()
...
...
src/idl_gen_go.cpp
View file @
b56d60f0
...
...
@@ -113,7 +113,13 @@ class GoGenerator : public BaseGenerator {
private
:
Namespace
go_namespace_
;
Namespace
*
cur_name_space_
;
std
::
set
<
const
Namespace
*>
tracked_imported_namespaces_
;
struct
NamespacePtrLess
{
bool
operator
()(
const
Namespace
*
a
,
const
Namespace
*
b
)
const
{
return
*
a
<
*
b
;
}
};
std
::
set
<
const
Namespace
*
,
NamespacePtrLess
>
tracked_imported_namespaces_
;
// Most field accessors need to retrieve and test the field offset first,
// this is the prefix code for that.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment