def generate_proto_go_source(target, source, env):
 source = source[0]
 global proto_import_re
 import_protos = proto_import_re.findall(source.get_text_contents())
 parameters = ('import_prefix=%s/' % env['PROTOBUFGOPATH'])
 if import_protos:
  proto_mappings = []
  for proto in import_protos:
   dir = os.path.dirname(proto)
   name = os.path.basename(proto)
   proto_mappings.append(('M%s=%s' % (proto, os.path.join(dir, name.replace('.', '_')))))
  parameters += (',%s' % ','.join(proto_mappings))
 cmd = ('%s --proto_path=. --plugin=protoc-gen-go=%s -I. %s -I=%s --go_out=%s:%s %s' % (env['PROTOC'], env['PROTOCGOPLUGIN'], env['PROTOBUFINCS'], os.path.dirname(str(source)), parameters, env['BUILDDIR'], source))
 return echospawn(args=[cmd], env=os.environ, sh=None, cmd=None, escape=None)

def generate_proto_go_source ( target , source , env ) : source = source [ 0 ] global proto_import_re import_protos = proto_import_re . findall ( source . get_text_contents ( ) ) parameters = ( 'import_prefix=%s/' % env [ 'PROTOBUFGOPATH' ] ) if import_protos : proto_mappings = [ ] for proto in import_protos : dir = os . path . dirname ( proto ) name = os . path . basename ( proto ) proto_mappings . append ( ( 'M%s=%s' % ( proto , os . path . join ( dir , name . replace ( '.' , '_' ) ) ) ) ) parameters += ( ',%s' % ',' . join ( proto_mappings ) ) cmd = ( '%s --proto_path=. --plugin=protoc-gen-go=%s -I. %s -I=%s --go_out=%s:%s %s' % ( env [ 'PROTOC' ] , env [ 'PROTOCGOPLUGIN' ] , env [ 'PROTOBUFINCS' ] , os . path . dirname ( str ( source ) ) , parameters , env [ 'BUILDDIR' ] , source ) ) return echospawn ( args = [ cmd ] , env = os . environ , sh = None , cmd = None , escape = None )
generate go source file by invoking protobuf compiler .