googleapis / googleapis/google-cloud-go
all: upcoming unmitigated breaking change in generated .pb.go files
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 1.6k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 109
Description
## Client
All GAPIC clients.
## Environment
All environments
## Impact
Generated service registration function signatures will change from [concrete types to an interfaces](https://github.com/grpc/grpc-go/issues/3966). 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:
```go
// 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
```
2. Passing the function as a parameter typed as the function signature, like so:
```go
// 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)
```
3. Making the function signature the type of a struct property, like so:
```go
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,
}
```
4. Reflecting over the exported surface looking for a function with the old signature.
Contributor guide
Assessment
This issue has not been assessed yet.