Skip to content

zserge/protoc-gen-micro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

protoc-gen-micro

This is protobuf code generation for micro. We use protoc-gen-micro to reduce boilerplate code.

We previously maintained a fork of golang/protobuf to include the micro plugin but have since moved to protoc-gen-micro.

Install

go get github.com/micro/protoc-gen-micro

Also required:

Usage

Define your service as greeter.proto

syntax = "proto3";

service Greeter {
	rpc Hello(Request) returns (Response) {}
}

message Request {
	string name = 1;
}

message Response {
	string msg = 1;
}

Generate the code

protoc --proto_path=$GOPATH/src:. --micro_out=. --go_out=. greeter.proto

Your output result should be:

./
    greeter.proto	# original protobuf file
    greeter.pb.go	# auto-generated by protoc-gen-go
    greeter.micro.go	# auto-generated by protoc-gen-micro

The micro generated code includes clients and handlers which reduce boiler plate code

LICENSE

protoc-gen-micro is a liberal reuse of protoc-gen-go hence we maintain the original license

About

Protobuf code generation for micro

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published