Skip to content

Commit

Permalink
fix(gengapic): ensure input type imported (#1434)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahdietz authored Nov 1, 2023
1 parent 6627528 commit f6be536
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions internal/gengapic/client_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (g *generator) internalClientIntfInit(serv *descriptor.ServiceDescriptorPro
if err != nil {
return err
}
g.imports[inSpec] = true
if m.GetOutputType() == emptyType {
p("%s(context.Context, *%s.%s, ...gax.CallOption) error",
m.GetName(),
Expand Down
16 changes: 10 additions & 6 deletions internal/gengapic/client_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,15 @@ func TestClientInit(t *testing.T) {
serv: servPlain,
parameter: proto.String("go-gapic-package=path;mypackage,transport=rest"),
imports: map[pbinfo.ImportSpec]bool{
{Path: "context"}: true,
{Path: "google.golang.org/api/option"}: true,
{Path: "google.golang.org/api/option/internaloption"}: true,
{Path: "google.golang.org/grpc"}: true,
{Path: "net/http"}: true,
{Name: "httptransport", Path: "google.golang.org/api/transport/http"}: true,
{Path: "context"}: true,
{Path: "google.golang.org/api/option"}: true,
{Path: "google.golang.org/api/option/internaloption"}: true,
{Path: "google.golang.org/grpc"}: true,
{Path: "net/http"}: true,
{Name: "httptransport", Path: "google.golang.org/api/transport/http"}: true,
{Name: "iampb", Path: "cloud.google.com/go/iam/apiv1/iampb"}: true,
{Name: "locationpb", Path: "google.golang.org/genproto/googleapis/cloud/location"}: true,
{Name: "mypackagepb", Path: "github.com/googleapis/mypackage"}: true,
},
wantNumSnps: 6,
},
Expand Down Expand Up @@ -498,6 +501,7 @@ func TestClientInit(t *testing.T) {
{Path: "google.golang.org/grpc"}: true,
{Path: "net/http"}: true,
{Name: "httptransport", Path: "google.golang.org/api/transport/http"}: true,
{Name: "mypackagepb", Path: "github.com/googleapis/mypackage"}: true,
},
wantNumSnps: 1,
setExt: func() (protoreflect.ExtensionType, interface{}) {
Expand Down

0 comments on commit f6be536

Please sign in to comment.