-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (33 loc) · 809 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Package main is the entry point for the CLI binary
package main
import (
"context"
"log/slog"
"os"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"github.com/boyvinall/observability-demo/pkg/boomer"
)
func main() {
ctx := context.Background()
address := "localhost:8080"
conn, err := grpc.DialContext(ctx, address, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
slog.Error("failed to dial", "error", err)
return
}
defer conn.Close()
client := boomer.NewBoomerClient(conn)
name := "old dude"
if len(os.Args) > 1 {
name = os.Args[1]
}
resp, err := client.Boom(ctx, &boomer.BoomRequest{
Name: name,
})
if err != nil {
slog.Error("failed to boom", "error", err)
return
}
slog.Info("response", "message", resp.Message)
}