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

Getting a deprecation warning message? #1104

Closed
aaabhilash97 opened this issue Apr 25, 2020 · 5 comments
Closed

Getting a deprecation warning message? #1104

aaabhilash97 opened this issue Apr 25, 2020 · 5 comments

Comments

@aaabhilash97
Copy link

Any idea why I'm getting this warning message?.

WARNING: Package "github.com/golang/protobuf/protoc-gen-go/generator" is deprecated.
	A future release of golang/protobuf will delete this package,
	which has long been excluded from the compatibility promise.

Running these commands

protoc \
 		--proto_path=api/proto --proto_path=third_party/include \
  		--proto_path=third_party/ --grpc-gateway_out=logtostderr=true:pkg/api \
		  $(PROTO_ENTRY);

 protoc \
 		--proto_path=api/proto --proto_path=third_party/include \
  		--proto_path=third_party/ --grpc-gateway_out=logtostderr=true:pkg/api \
		  $(PROTO_ENTRY);
@dsnet
Copy link
Member

dsnet commented Apr 25, 2020

The "github.com/golang/protobuf/protoc-gen-go/generator" package is the internal implementation of protoc-gen-go and was never intended for users to depend on. The reason it is publicly available is because the concept of an internal package was not introduced until go1.4. Even though the internal package mechanism did not exist back then, we have still documented that this package should not be used by users.

You're seeing the warning because either you are directly depending on the generator package or something you depend on is depending on the generator package. I recommend that you find out what is directly using the generator package and tell them to migrate to the protogen package or to fork the generator package and depend on their own local fork.

@aaabhilash97
Copy link
Author

Thanks to @dsnet .
Package github.com/grpc-ecosystem/grpc-gateway using generator package internally.

@adi69
Copy link

adi69 commented Jul 22, 2020

Thanks to @dsnet .
Package github.com/grpc-ecosystem/grpc-gateway using generator package internally.

Fix for this was merged grpc-ecosystem/grpc-gateway#1260 and released in the version https://github.com/grpc-ecosystem/grpc-gateway/releases/tag/v1.14.5

rolinh added a commit to cilium/cilium that referenced this issue Jul 27, 2020
Commit `f18fcd9b` updated the following dependencies:

  - github.com/golang/protobuf: v1.3.2  => v1.4.2
  - google.golang.org/genproto
  - google.golang.org/grpc:     v1.26.0 => v1.27.0

However, the protobuf generated files were not re-generated which is
what this commit addresses.

The newly generated files should be backward compatible. However, the
following warning is now emitted when generating them:

  WARNING: Package "github.com/golang/protobuf/protoc-gen-go/generator"
           is deprecated.
           A future release of golang/protobuf will delete this package,
           which has long been excluded from the compatibility promise.

This is because this package was apparently never meant to be public as
explained in this comment[0]. The fix for this is to migrate to
`google.golang.org/protobuf/compiler/protogen` but this can't be done
until a release of `grpc-go` which includes the following patch[1] is
out. Update the Makefile to output a note with regard to this when generating
the files

It appears that with the newly generated files, protobuf now needs to
be marked as an explicit dep. Fix it by by running:

    go mod tidy && go mod vendor && go mod verify

Fix: f18fcd9

[0]: golang/protobuf#1104 (comment)
[1]: grpc/grpc-go#3453

Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
gandro pushed a commit to cilium/cilium that referenced this issue Jul 27, 2020
Commit `f18fcd9b` updated the following dependencies:

  - github.com/golang/protobuf: v1.3.2  => v1.4.2
  - google.golang.org/genproto
  - google.golang.org/grpc:     v1.26.0 => v1.27.0

However, the protobuf generated files were not re-generated which is
what this commit addresses.

The newly generated files should be backward compatible. However, the
following warning is now emitted when generating them:

  WARNING: Package "github.com/golang/protobuf/protoc-gen-go/generator"
           is deprecated.
           A future release of golang/protobuf will delete this package,
           which has long been excluded from the compatibility promise.

This is because this package was apparently never meant to be public as
explained in this comment[0]. The fix for this is to migrate to
`google.golang.org/protobuf/compiler/protogen` but this can't be done
until a release of `grpc-go` which includes the following patch[1] is
out. Update the Makefile to output a note with regard to this when generating
the files

It appears that with the newly generated files, protobuf now needs to
be marked as an explicit dep. Fix it by by running:

    go mod tidy && go mod vendor && go mod verify

Fix: f18fcd9

[0]: golang/protobuf#1104 (comment)
[1]: grpc/grpc-go#3453

Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
rolinh added a commit to cilium/cilium that referenced this issue Aug 4, 2020
This update requires non-trivial changes to the way we generate files
from `proto` definitions:

  - Replace `github.com/golang/protobuf/protoc-gen-go` with
    `google.golang.org/grpc/cmd/protoc-gen-go-grpc`. The former is
    deprecated as it is an internal implementation of `protoc-gen-go`.
    For more information, see [0].
    Note that this package is still imported by the following plugin
    that we use: `github.com/envoyproxy/protoc-gen-validate`. I have
    bumped the version to the latest one (v0.4.0) but there is no
    version nor PR yet that update the import path for this one so a
    warning is still being issued when we generate the files from the
    `proto` definitions.
  - All `proto` files now need to specify `option go_package`.
  - Update the Makefile to use the `paths=source_relative`. This allows
    removing the `RAW_GO_MAPPINGS` definition and it works fine with the
    new `go_package` option. Without this change, the files would be
    generated to a folder named after the `go_package` option relative
    to the `Makefile` (eg: `./github.com/cilium/cilium/api/v1/flow`).
  - Use new `go-grpc_out` option with `protoc`. This generates the gRPC
    realted Go code using the `protoc-gen-go-grpc` plugin. The `go_out`
    option does not generate gRPC related Go code anymore.

[0]: golang/protobuf#1104 (comment)

Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
aanm pushed a commit to cilium/cilium that referenced this issue Aug 5, 2020
This update requires non-trivial changes to the way we generate files
from `proto` definitions:

  - Replace `github.com/golang/protobuf/protoc-gen-go` with
    `google.golang.org/grpc/cmd/protoc-gen-go-grpc`. The former is
    deprecated as it is an internal implementation of `protoc-gen-go`.
    For more information, see [0].
    Note that this package is still imported by the following plugin
    that we use: `github.com/envoyproxy/protoc-gen-validate`. I have
    bumped the version to the latest one (v0.4.0) but there is no
    version nor PR yet that update the import path for this one so a
    warning is still being issued when we generate the files from the
    `proto` definitions.
  - All `proto` files now need to specify `option go_package`.
  - Update the Makefile to use the `paths=source_relative`. This allows
    removing the `RAW_GO_MAPPINGS` definition and it works fine with the
    new `go_package` option. Without this change, the files would be
    generated to a folder named after the `go_package` option relative
    to the `Makefile` (eg: `./github.com/cilium/cilium/api/v1/flow`).
  - Use new `go-grpc_out` option with `protoc`. This generates the gRPC
    realted Go code using the `protoc-gen-go-grpc` plugin. The `go_out`
    option does not generate gRPC related Go code anymore.

[0]: golang/protobuf#1104 (comment)

Signed-off-by: Robin Hahling <robin.hahling@gw-computing.net>
@adranwit
Copy link

adranwit commented Aug 11, 2020

Could you please silence this warning, annotation, and lack of that dependency in the future would be good enough trigger to address it, I have many 3rd party dep, it is almost impossible to get rid of that message. Once it's broken all 3rd part-owner address the issue I would think. For now, any new release of my CLI is coming with this message, really messed up.

alpeb added a commit to linkerd/linkerd2 that referenced this issue Sep 14, 2020
This adds a `replace` statement to `go.mod` to force the newer version `1.14.x` of `github.com/grpc-ecosystem/grpc-gateway` to avoid the following warning in all the controller container logs:

```
WARNING: Package "github.com/golang/protobuf/protoc-gen-go/generator" is deprecated.
A future release of golang/protobuf will delete this package,
which has long been excluded from the compatibility promise.
```

More info [here](golang/protobuf#1104)
alpeb added a commit to linkerd/linkerd2 that referenced this issue Sep 16, 2020
This adds a `replace` statement to `go.mod` to force the newer version `1.14.x` of `github.com/grpc-ecosystem/grpc-gateway` to avoid the following warning in all the controller container logs:

```
WARNING: Package "github.com/golang/protobuf/protoc-gen-go/generator" is deprecated.
A future release of golang/protobuf will delete this package,
which has long been excluded from the compatibility promise.
```

More info [here](golang/protobuf#1104)
@jkuri
Copy link

jkuri commented Apr 4, 2021

Placing this in go.mod and running go mod tidy removes the warning for me.

replace (
  github.com/grpc-ecosystem/grpc-gateway => github.com/grpc-ecosystem/grpc-gateway v1.14.5
)

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

5 participants