Skip to content

all: upcoming unmitigated breaking change in generated .pb.go files #11020

@quartzmo

Description

@quartzmo

Client

All GAPIC clients.

Environment

All environments

Impact

Generated service registration function signatures will change from concrete types to an interfaces. Note that there will be no impact on most usages because the previous concrete type and generated service code both already implemented the interface.

However, customers that reference the modified code in one or more of the following four ways will be broken by an unmitigated change:

  1. Creating a variable with the generated function signature as the type for use in code, like so:
// Where *grpc.Server is being changed to grpc.ServiceRegistrar
var myRegisterFunc func(*grpc.Server, FooServer)

// call site that would break with change to RegisterFooServer
myRegisterFunc = foopb.RegisterFooServer
  1. Passing the function as a parameter typed as the function signature, like so:
// Where *grpc.Server is being changed to grpc.ServiceRegistrar
func myFunc(registerFunc func(*grpc.Server, FooServer)) { ... }

// call site that would break with change to RegisterFooServer
myFunc(foopb.RegisterFooServer)
  1. Making the function signature the type of a struct property, like so:
type MyFoo struct {
  // Where *grpc.Server is being changed to grpc.ServiceRegistrar

  RegisterFoo func(*grpc.Server, FooServer)
}

// call site that would break with change to RegisterFooServer
myFoo := MyFoo{
  RegisterFoo: foopb.RegisterFooServer,
}
  1. Reflecting over the exported surface looking for a function with the old signature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: cleanupAn internal cleanup or hygiene concern.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions