Skip to content

Commit

Permalink
Merge pull request #120 from nockty/helpers
Browse files Browse the repository at this point in the history
Make generated code use public helpers instead of generating them
  • Loading branch information
vmg authored Dec 7, 2023
2 parents d930d8a + 42f444a commit c139c98
Show file tree
Hide file tree
Showing 32 changed files with 4,885 additions and 6,444 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,9 @@ The following features can be generated:
7. (Optional) Switch your RPC framework to use the optimized helpers (see following sections)
## Well-known types
## `vtprotobuf` package and well-known types
By default, `vtprotobuf` will detect ProtoBuf [well-known types](https://protobuf.dev/reference/protobuf/google.protobuf/) embedded in your own Messages and generate optimized code to marshal and unmarshal them.
In order to access the optimized code for these types, your `_vtproto.pb.go` files will have a dependency on this Go package. If this is not acceptable, you can disable well-known types with `--go-vtproto_opt=wkt=false`.
Your generated `_vtproto.pb.go` files will have a dependency on this Go package to access some helper functions as well as the optimized code for ProtoBuf [well-known types](https://protobuf.dev/reference/protobuf/google.protobuf/). `vtprotobuf` will detect these types embedded in your own Messages and generate optimized code to marshal and unmarshal them.
## Using the optimized code with RPC frameworks
Expand Down
1 change: 0 additions & 1 deletion cmd/protoc-gen-go-vtproto/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func main() {
cfg.Poolable = make(generator.ObjectSet)
f.Var(&cfg.Poolable, "pool", "use memory pooling for this object")
f.BoolVar(&cfg.Wrap, "wrap", false, "generate wrapper types")
f.BoolVar(&cfg.WellKnownTypes, "wkt", true, "generate optimized code for well-known types")
f.StringVar(&features, "features", "all", "list of features to generate (separated by '+')")

protogen.Options{ParamFunc: f.Set}.Run(func(plugin *protogen.Plugin) error {
Expand Down
Loading

0 comments on commit c139c98

Please sign in to comment.