Skip to content

Commit

Permalink
Updating readme
Browse files Browse the repository at this point in the history
  • Loading branch information
drekle committed Nov 1, 2019
1 parent 190a0df commit 9e85b69
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# protoc-gen-goexample
An example of a protoc plugin in go

## Build
```
go build .
```

## Run the plugin
```
protoc --plugin protoc-gen-goexample --goexample_out=output example.proto
```

## Passing additional data to generators
Parameters may be set for additional information
```
protoc --plugin protoc-gen-goexample --goexample_out=param1=value1,param2=value2:output example.proto
```
I believe an equivalent, cleaner, way to do this would be using the opt argument
```
protoc --plugin ./protoc-gen-goexample --goexample_out=output --goexample_opt=param1=value1,param2=value2 example.proto
```
Parameters shall apply to multiple files. See an example in generateCode for parsing comments. You might consider using annotations as comments to apply additional data at the message level, or field level, by adding annotations as leading comments.

0 comments on commit 9e85b69

Please sign in to comment.