api-common-protos
api-common-protos copied to clipboard
Warnings from protoc: Import google/api/annotations.proto is unused
Environment details
- Programming language: C++
- OS: Ubuntu 22.04
- Language runtime version: Protobuf 3.12.4
- Package version: 1.50.0
Steps to reproduce
- Run
protoc
on all the.proto
files - The following warnings are reported:
google/api/auth.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/api/billing.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/api/endpoint.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/api/logging.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/api/monitoring.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/api/quota.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/api/service.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/api/usage.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/iam/v1/logging/audit_data.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/iam/v1/policy.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/logging/type/http_request.proto:19:1: warning: Import google/api/annotations.proto is unused.
google/logging/type/log_severity.proto:19:1: warning: Import google/api/annotations.proto is unused.
- The generation then completes successfully
Discussion
These warnings don't break anything, but they are a false positive. They waste our and our user's time by bringing attention to a non-existent problem. We could disable printing of all Protobuf warnings in our build setup, but then we could miss some actually important issues.
I suggest to remove the specified unused includes from those files. Or is there a flag I can pass to protoc
to silence specifically "unused import" warnings?