diff --git a/sdk/go/README.md b/sdk/go/README.md index 079071b4b4..386331bdf6 100644 --- a/sdk/go/README.md +++ b/sdk/go/README.md @@ -43,14 +43,18 @@ import ( sdk "go.flipt.io/flipt/sdk/go" sdkgrpc "go.flipt.io/flipt/sdk/go/grpc" grpc "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) func main() { token := sdk.StaticTokenAuthenticationProvider("a-flipt-client-token") - conn := grpc.Dial("localhost:9090") - transport := sdkgrpc.NewTransport(conn) + conn, err := grpc.NewClient("localhost:9000", grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + panic(err) + } + defer conn.Close() - client := sdk.New(transport, sdk.WithAuthenticationProvider(token)) + client := sdk.New(sdkgrpc.NewTransport(conn), sdk.WithAuthenticationProvider(token)) } -``` +``` \ No newline at end of file diff --git a/sdk/go/doc.go b/sdk/go/doc.go index 4da4cd3387..0b4e664475 100644 --- a/sdk/go/doc.go +++ b/sdk/go/doc.go @@ -15,7 +15,7 @@ The main entrypoint within this package is [New], which takes an instance of [Tr The following is an example of creating and instance of the SDK using the gRPC transport. func main() { - conn := grpc.Dial("localhost:9090") + conn, _ := grpc.NewClient("localhost:9000") transport := grpc.NewTransport(conn) client := sdk.New(transport) } diff --git a/sdk/go/grpc/example_test.go b/sdk/go/grpc/example_test.go index 43299c9f41..f9e13dafac 100644 --- a/sdk/go/grpc/example_test.go +++ b/sdk/go/grpc/example_test.go @@ -8,7 +8,7 @@ import ( ) func ExampleNewTransport() { - cc, _ := grpc.Dial("localhost:9090") + cc, _ := grpc.NewClient("localhost:9000") transport := NewTransport(cc)