Skip to content

support --go_opt=default_api_level and --go_opt=apilevelM flags #12

@stapelberg

Description

@stapelberg

Currently, the open2opaque tool obtains the default API level (see https://protobuf.dev/reference/go/go-generated-opaque/#apilevel) by querying the google.golang.org/protobuf/compiler/protogen package.

This does not cover the case where users change the default API level via the protoc Go plugin command-line option --go_opt=default_api_level or --go_opt=apilevelM.

For open2opaque setapi, knowledge of the correct default is important, because explicit API level overrides will not be added when they match the default. For example, if an organization builds with --go_opt=default_api_level=HYBRID, then open2opaque setapi --api=OPEN will not result in a option features.(pb.go).api_level = API_OPEN; line (but will be a no-op, because it matches what open2opaque incorrectly considers the default).

We should implement support in the open2opaque tool for these two flags so that users can copy the flags from their protoc invocation to their open2opaque tool invocation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions