https://github.com/zserge/protoc-gen-micro
Protobuf code generation for micro
https://github.com/zserge/protoc-gen-micro
Last synced: 11 months ago
JSON representation
Protobuf code generation for micro
- Host: GitHub
- URL: https://github.com/zserge/protoc-gen-micro
- Owner: zserge
- Created: 2018-03-17T18:11:31.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-17T19:08:55.000Z (about 8 years ago)
- Last Synced: 2025-04-10T11:36:00.688Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 36.1 KB
- Stars: 3
- Watchers: 1
- Forks: 98
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# protoc-gen-micro
This is protobuf code generation for micro. We use protoc-gen-micro to reduce boilerplate code.
We previously maintained a [fork](https://github.com/micro/protobuf) of [golang/protobuf](https://github.com/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:
- [protoc](https://github.com/google/protobuf)
- [protoc-gen-go](https://github.com/golang/protobuf)
## 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