Categorygithub.com/KennyChenFight/protogen-demo
repositorypackage
0.0.0-20220710074651-b4572fd26b10
Repository: https://github.com/kennychenfight/protogen-demo.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

protogen-demo

show how to develop your own proto codegen plugin, you can also read my blog post !

protoc-gen-demo

use google.golang.org/protobuf/compiler/protogen lib to demo how to develop proto codegen plugin

go build -o ./protoc-gen-demo/protoc-gen-demo.bin ./protoc-gen-demo
protoc \
--plugin=protoc-gen-demo=./protoc-gen-demo/protoc-gen-demo.bin \
--go_out=paths=source_relative:. \
--demo_out=foo=bar,paths=source_relative:. \
proto/pb.proto

protoc-gen-demo2

use github.com/lyft/protoc-gen-star lib to demo how to develop proto codegen plugin

go build -o ./protoc-gen-demo/protoc-gen-demo.bin ./protoc-gen-demo
protoc \
--plugin=protoc-gen-demo2=./protoc-gen-demo2/protoc-gen-demo2.bin \
--go_out=paths=source_relative:. \
--demo2_out=foo=bar,paths=source_relative:. \
proto/pb.proto

protoc-gen-debug

show how to debug your own plugin

  1.  protoc \                                                                                 
     --plugin=protoc-gen-debug=./protoc-gen-debug/protoc-gen-debug.bin \
     --go_out=paths=source_relative:. \
     --debug_out=.:. \                    
     proto/pb.proto
    
  2. and run go run main.go in protogen-demo folder`