func runClient(service micro.Service, name string) { // Create new greeter client greeter := greeterProto.NewGreeterClient("greeter", service.Client()) // Call the greeter rsp, err := greeter.Hello(context.TODO(), &greeterProto.HelloRequest{Name: name}) if err != nil { fmt.Println(err) return } // Print response fmt.Println(rsp.Greeting) }
func runClient(service micro.Service, c *cli.Context) { // Create new greeter client greeter := greeterProto.NewGreeterClient("greeter", service.Client()) name := "World" if flagName := c.String("name"); flagName != "" { name = flagName } // Call the greeter rsp, err := greeter.Hello(context.TODO(), &greeterProto.HelloRequest{Name: name}) if err != nil { fmt.Println(err) return } // Print response fmt.Println(rsp.Greeting) }