kumahq / kuma

🐻 The multi-zone service mesh for containers, Kubernetes and VMs. Built with Envoy. CNCF Sandbox Project.
https://kuma.io/install
Apache License 2.0
3.67k stars 333 forks source link

chore(deps): remove deprecated protobuf dependency #12038

Open Icarus9913 opened 1 week ago

Icarus9913 commented 1 week ago

Motivation

The repo github.com/golang/protobuf is deprecated and we should switch to use google.golang.org/protobuf.

However we can't totally get rid of it because we still need the github.com/golang/protobuf/jsonpb and there's a incompatibility for google.golang.org/protobuf/encoding/protojson. So, I add one golangci linter to warn it.

Implementation information

Supporting documentation

Fix #3499

lahabana commented 1 week ago

We should change the linter to disallow new usages of github.com/golang so that any newer usage uses comment based exception. This will force anyone that wants to use this package again to have to think twice before doing it.

Icarus9913 commented 1 week ago

@lahabana How about the new changes?

  1. rejected all of the GolangProtobuf new usages
  2. loosen the GolangProtobuf jsonpb with // nolint: depguard
  3. recommend anyone who wants to use GoogleProtobuf protojson to switch back to GolangProtobuf jsonpb. Otherwise if the user consist to use GoogleProtobuf protojson, let them just add // nolint: depguard

~However, in this way anyone who wants to use json* whichever they choosem, they have to add // nolint: depguard~ OK, everyone would have a note what happened for the json* SDK and be more careful

lahabana commented 3 days ago

LGTM intuitively for the lint rules. I'm not sure I'm grasping everything with the code change so not approving.