Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twirp generates code that uses deprecated protobuf libraries #301

Closed
RoarkeRandall opened this issue Apr 5, 2021 · 3 comments
Closed

Twirp generates code that uses deprecated protobuf libraries #301

RoarkeRandall opened this issue Apr 5, 2021 · 3 comments

Comments

@RoarkeRandall
Copy link

Our team uses staticcheck, https://staticcheck.io, for linting our go programs. It's convenient to run staticcheck ./... on a repo in our ci pipelines. We are getting the following errors for the generated twirp code:

pkg/go/service.twirp.go:21:8: package github.com/golang/protobuf/jsonpb is deprecated: Use the "google.golang.org/protobuf/encoding/protojson" package instead.  (SA1019)
pkg/go/service.twirp.go:22:8: package github.com/golang/protobuf/proto is deprecated: Use the "google.golang.org/protobuf/proto" package instead.  (SA1019)

We are able to ignore these at a file level, but it requires us to manually add a line of code to the top of the generated file. Obviously editing generated code isn't a great solution.

Is it possible for twirp to update the generated code to use the latest protobuf packages?

@mfridman
Copy link
Contributor

mfridman commented Apr 6, 2021

The long-term solution is for twirp to update to the new protobuf packages. But, its also a limitation of statickcheck (see this issue and comment).

It takes time for the ecosystem/community to update open-source projects, and statickcheck takes a very all/none approach.

We just ended up with a very unideal situation..

checks = [..., "-SA1019"]

I know this doesn't help you @RoarkeRandall, but you're not alone.

@3ventic
Copy link
Contributor

3ventic commented Apr 6, 2021

See also #222.

@3ventic
Copy link
Contributor

3ventic commented May 4, 2021

Twirp v8 generates clients using the new protobuf packages. Refer to the release for the quick upgrade instructions.

@3ventic 3ventic closed this as completed May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants