Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
grpc-gateway_out does not entirely obey the -M parameter #229
I'm using grpc-gateway_out with the github.com/gogo/protobuf project and I came across a case where the grpc-gateway generated code is invalid when using the -M parameter to the compiler.
When using the
This results in both an unused import and an undefined reference compile error. The correct action should be to use
referenced this issue
Oct 6, 2016
any updates on this issue? currently running into this. doing
results in getting the proper import
At work I wrote a post-generate workaround for this in python:
def correct_grpc_gateway_imports(package): ''' Workaround for https://github.com/grpc-ecosystem/grpc-gateway/issues/229. Replace instances of 'empty.Empty' with 'types.Empty' in any files. ''' for root, dirs, filenames in os.walk(package): for filename in filenames: with open(os.path.join(root, filename), 'r') as f: file_contents = f.read() file_contents = file_contents.replace('empty.Empty', 'types.Empty') with open(os.path.join(root, filename), 'w') as f: f.write(file_contents)
@awalterschulze, at this point I don't use gogoproto and so it isn't at the top of my priority queue. It is definitely a correctness issue, but I won't have the cycles to fix it. I don't think it would be extremely difficult to fix in the generator.