Skip to content

Commit

Permalink
doc(sdk): update go sdk examples with new change in gRPC
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Dmytrenko <[email protected]>
  • Loading branch information
erka committed Aug 9, 2024
1 parent c60caea commit ed6ceba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions sdk/go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
```
```

Check failure on line 60 in sdk/go/README.md

View workflow job for this annotation

GitHub Actions / Lint Markdown

Files should end with a single newline character

sdk/go/README.md:60:3 MD047/single-trailing-newline Files should end with a single newline character https://github.com/DavidAnson/markdownlint/blob/v0.34.0/doc/md047.md
2 changes: 1 addition & 1 deletion sdk/go/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/go/grpc/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func ExampleNewTransport() {
cc, _ := grpc.Dial("localhost:9090")
cc, _ := grpc.NewClient("localhost:9000")

transport := NewTransport(cc)

Expand Down

0 comments on commit ed6ceba

Please sign in to comment.