Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #222, #301
Related: #299, #280, #275
Description
The protobuf library has updated from APIV1
github.com/golang/protobuf
to APIV2google.golang.org/protobuf
. Now Twirp generates code using the new types.Changes:
github.com/golang/protobuf/jsonpb
, it now usesgoogle.golang.org/protobuf/protojson
github.com/golang/protobuf/proto
, it now usesgoogle.golang.org/protobuf/proto
protoc-gen-twirp
) works with the latest version ofgoogle.golang.org/protobuf
protoc-gen-twirp
) improved usage of command line flags. It now acceptspaths=import
(default),paths=source_relative
,module={PREFIX}
and works well with multiple--proto_path
sources. This makes it fully compatible with the flags used onprotoc-gen-go
compiler invocation: https://developers.google.com/protocol-buffers/docs/reference/go-generated#invocationgo_package
on test proto files to use a fully qualified go import path. This is required by new versions ofprotoc-gen-go
.Update instructions
github.com/twitchtv/twirp
does not have any changes.github.com/twitchtv/twirp/protoc-gen-twirp
) will update their imports fromgithub.com/golang/protobuf/proto
(APIV1) togoogle.golang.org/protobuf
(APIV2). Projects that make use of the generated clients or service have to update the imports as well.google.golang.org/protobuf
(APIV2) is mostly backwards compatible, but not completely. Some changes that we found needed in our own tests:option go_package
is mandatory and must include a "/" (it is supposed to be a full import path). If you have to add a full path to the go_package, you may want to generate with the optionspaths=source_relative
. For example:protoc --go_out=. --go_opt=paths=source_relative --twirp_out=. --twirp_opt=paths=source_relative myfile.proto
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.