from const import gofile_path


def genGolangfile(protos):
    fileContent = ""
    fileContent += (
    'package msg'
    '\n'
    'import (\n'
    '	"github.com/name5566/leaf/network/protobuf"\n'
    ')'
    '\n\n'
    'var (\n'
    '	Processor = protobuf.NewProcessor()\n'
    ')\n'
    '\n'
    'func init() {'
    '	// 这里我们注册了一个 protobuf 消息)\n'
    )


    for index in range(len(protos)):
        fileContent += '' \
                       '    Processor.Register(&'
        fileContent += protos[index]
        fileContent += '{})\n'

    fileContent += ("\n}")

    fo = open(gofile_path, "wb")
    fo.write(fileContent.encode('utf-8'))
    fo.close()



@@ -327,11 +327,8 @@
 %E6%88%91%E4%BB%AC%E6%B3%A8%E5%86%8C
-%E4%BA%86%E4%B8%80%E4%B8%AA
  pro
@@ -336,24 +336,66 @@
 obuf %E6%B6%88%E6%81%AF)%5Cn'%0A
+     '    Processor.SetByteOrder(true)%5Cn'%0A
     )%0A%0A%0A    

Update gofile.py