diff --git a/CHANGES.md b/CHANGES.md index 8481d1173..9c81fadcc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ ### Go - [THRIFT-5539](https://issues.apache.org/jira/browse/THRIFT-5539) - `TDebugProtocol.DuplicateTo` is now deprecated, `TDuplicateToProtocol` has been provided as the replacement +- [THRIFT-5583](https://issues.apache.org/jira/browse/THRIFT-5583) - Add `skip_remote` arg to compiler, which can be used to skip the generating of -remote folders for services ## 0.16.0 diff --git a/compiler/cpp/src/thrift/generate/t_go_generator.cc b/compiler/cpp/src/thrift/generate/t_go_generator.cc index 020297b9b..4833420c9 100644 --- a/compiler/cpp/src/thrift/generate/t_go_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_go_generator.cc @@ -83,6 +83,7 @@ public: package_flag = ""; read_write_private_ = false; ignore_initialisms_ = false; + skip_remote_ = false; for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) { if( iter->first.compare("package_prefix") == 0) { gen_package_prefix_ = (iter->second); @@ -94,6 +95,8 @@ public: read_write_private_ = true; } else if( iter->first.compare("ignore_initialisms") == 0) { ignore_initialisms_ = true; + } else if( iter->first.compare("skip_remote") == 0) { + skip_remote_ = true; } else { throw "unknown option go:" + iter->first; } @@ -297,6 +300,7 @@ private: std::string gen_thrift_import_; bool read_write_private_; bool ignore_initialisms_; + bool skip_remote_; /** * File streams @@ -2015,7 +2019,9 @@ void t_go_generator::generate_service(t_service* tservice) { generate_service_client(tservice); generate_service_server(tservice); generate_service_helpers(tservice); - generate_service_remote(tservice); + if(!skip_remote_) { + generate_service_remote(tservice); + } f_types_ << endl; } @@ -4267,4 +4273,6 @@ THRIFT_REGISTER_GENERATOR(go, "Go", " ignore_initialisms\n" " Disable automatic spelling correction of initialisms (e.g. \"URL\")\n" \ " read_write_private\n" - " Make read/write methods private, default is public Read/Write\n") + " Make read/write methods private, default is public Read/Write\n" + " skip_remote\n" + " Skip the generating of -remote folders for the client binaries for services\n") diff --git a/lib/go/test/Makefile.am b/lib/go/test/Makefile.am index e1cf8cda7..4392ebe19 100644 --- a/lib/go/test/Makefile.am +++ b/lib/go/test/Makefile.am @@ -23,9 +23,13 @@ else GOBUILDEXTRA = endif -THRIFTARGS = -out gopath/src/ --gen go:thrift_import=github.com/apache/thrift/lib/go/thrift,package_prefix=github.com/apache/thrift/lib/go/test/gopath/src/$(COMPILER_EXTRAFLAG) +THRIFT_GO_ARGS_BASE = thrift_import=github.com/apache/thrift/lib/go/thrift,package_prefix=github.com/apache/thrift/lib/go/test/gopath/src/ + +THRIFTARGS = -out gopath/src/ --gen go:$(THRIFT_GO_ARGS_BASE)$(COMPILER_EXTRAFLAG) THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift +THRIFTARGS_SKIP_REMOTE = -out gopath/src/ --gen go:skip_remote,$(THRIFT_GO_ARGS_BASE)$(COMPILER_EXTRAFLAG) + # Thrift for GO has problems with complex map keys: THRIFT-2063 gopath: $(THRIFT) $(THRIFTTEST) \ IncludesTest.thrift \ @@ -91,7 +95,7 @@ gopath: $(THRIFT) $(THRIFTTEST) \ $(THRIFT) $(THRIFTARGS) EqualsTest.thrift $(THRIFT) $(THRIFTARGS) ConflictArgNamesTest.thrift $(THRIFT) $(THRIFTARGS) -r ConstOptionalField.thrift - $(THRIFT) $(THRIFTARGS) ProcessorMiddlewareTest.thrift + $(THRIFT) $(THRIFTARGS_SKIP_REMOTE) ProcessorMiddlewareTest.thrift ln -nfs ../../tests gopath/src/tests cp -r ./dontexportrwtest gopath/src touch gopath