Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gencli): don't generate grpc.WithInsecure #1503

Merged
merged 4 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/gencli/service_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/spf13/viper"
"google.golang.org/api/option"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"golang.org/x/oauth2"
{{ range $key, $pkg := .Imports}}
{{ $pkg.Name }} "{{ $pkg.Path }}"
Expand Down Expand Up @@ -89,7 +90,7 @@ var {{ $serviceCmdVar }} = &cobra.Command{
return fmt.Errorf("Missing address to use with insecure connection")
}

conn, err := grpc.Dial(address, grpc.WithInsecure())
conn, err := grpc.Dial(address, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion internal/gencli/testdata/service_file.want
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"golang.org/x/oauth2"
"google.golang.org/api/option"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

proto "github.com/golang/protobuf/proto"
)
Expand Down Expand Up @@ -63,7 +64,7 @@ var TodoServiceCmd = &cobra.Command{
return fmt.Errorf("Missing address to use with insecure connection")
}

conn, err := grpc.Dial(address, grpc.WithInsecure())
conn, err := grpc.Dial(address, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion showcase/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var restClientOpts = []option.ClientOption{
func TestMain(m *testing.M) {
flag.Parse()

conn, err := grpc.Dial("localhost:7469", grpc.WithInsecure())
conn, err := grpc.Dial("localhost:7469", grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
log.Fatal(err)
}
Expand Down
Loading