summaryrefslogtreecommitdiff
path: root/src/idl_gen_go.cpp
diff options
context:
space:
mode:
authorDerek Bailey <dbaileychess@gmail.com>2020-03-02 10:15:23 -0800
committerGitHub <noreply@github.com>2020-03-02 10:15:23 -0800
commit6ff1898413a56577bd2e9abd8280a79b1880bd53 (patch)
tree121c2b564096a79ff8097fe821f25a33a8a43eec /src/idl_gen_go.cpp
parentc9a30c9ca28a6396455dd8be479f5a5edb412e62 (diff)
downloadflatbuffers-6ff1898413a56577bd2e9abd8280a79b1880bd53.tar.gz
flatbuffers-6ff1898413a56577bd2e9abd8280a79b1880bd53.tar.bz2
flatbuffers-6ff1898413a56577bd2e9abd8280a79b1880bd53.zip
Added --filename-suffix and --filename-ext to flatc (#5778)
* Fixed refractoring issue in reflection/generate_code.sh. Also, mv deletes the original file, so I don't need to clean it up manually in that case. * Added --filename-suffix and --filename-ext to flatc * Fixed typo and added example generation of suffix and extension for C++ * Removed extra ; * Removed clang-format block from a region that didn't need it. Fixed an auto format of another clang-format block * Added docs, fixed pointer alignment, removed suffix test file
Diffstat (limited to 'src/idl_gen_go.cpp')
-rw-r--r--src/idl_gen_go.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/idl_gen_go.cpp b/src/idl_gen_go.cpp
index 7ea554fe..a1a277ca 100644
--- a/src/idl_gen_go.cpp
+++ b/src/idl_gen_go.cpp
@@ -35,11 +35,6 @@
namespace flatbuffers {
-static std::string GeneratedFileName(const std::string &path,
- const std::string &file_name) {
- return path + file_name + "_generated.go";
-}
-
namespace go {
// see https://golang.org/ref/spec#Keywords
@@ -64,7 +59,7 @@ class GoGenerator : public BaseGenerator {
GoGenerator(const Parser &parser, const std::string &path,
const std::string &file_name, const std::string &go_namespace)
: BaseGenerator(parser, path, file_name, "" /* not used*/,
- "" /* not used */),
+ "" /* not used */, "go"),
cur_name_space_(nullptr) {
std::istringstream iss(go_namespace);
std::string component;
@@ -112,7 +107,8 @@ class GoGenerator : public BaseGenerator {
const bool is_enum = !parser_.enums_.vec.empty();
BeginFile(LastNamespacePart(go_namespace_), true, is_enum, &code);
code += one_file_code;
- const std::string filename = GeneratedFileName(path_, file_name_);
+ const std::string filename =
+ GeneratedFileName(path_, file_name_, parser_.opts);
return SaveFile(filename.c_str(), code, false);
}