install
Here, because the environments are inconsistent, we directly use docker to generate
- Install docker image
docker pull uber/prototool
Dockerhub: registry.hub.docker.com/r/uber/pro…
Github: github.com/uber/prototool
-
Define prototype Yaml configuration (docker container running configuration)
#Sample configuration. For more configurations, see the official generate: go_options: import_ path: ./ # Where to import the proto file plugins: -Name: PHP \ output: ./gen/php -Name: grpc PHP \ path: grpc_php_plugin output: ./gen/php -Name: go \go code for generating grpc file type: go flags: plugins=grpc output: ./gen/go
-
Run container generation code
The proto file directory runs, or you can specify a directory
docker run --rm -v $(pwd):/work uber/prototool prototool generate
-
complete
Screenshot of directory after generation
This work adoptsCC agreement, reprint must indicate the author and the link to this article