pb2go

command
v0.0.0-...-0507e34 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2016 License: BSD-3-Clause Imports: 8 Imported by: 0

README

功能

protobuf 生成 Go 文件如果每个.proto中的包名都不同,并且互相依赖,生成.go文件后需要重建import和目录组织,使用此工具可以自动重建。

使用

首先需要安装此工具,通过简单的命令便可安装完成:

go get -u github.com/drawing/protobuf/protoc-gen-go
go get -u github.com/drawing/protobuf/pb2go

把所有proto文件放入同一个目录:

im@im:~/ $ ls -l pbfiles/
total 49
-rwxrwxrwx 1 root root 18558  6月 15  2015 1.proto
-rwxrwxrwx 1 root root 24146  6月 15  2015 2.proto
-rwxrwxrwx 1 root root   298  6月 15  2015 3.proto

执行生成命令,指定源路径和生成的目标路径:

pb2go -in pbfiles/ -out .

执行完成后,便在目标路径根据包名重建目录,使用时直接import对应包即可。

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL