Brijesh's Git Server — trying-grpc @ 7cf3ce98e6bd56af5f66a0807211d2e021d295ca

Trying to use GRPC in go using twitchs twirp packge

cmd/client/main.go (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
package main

import (
	"context"
	"fmt"
	"github.com/wbrijesh/trying-trpc/rpc/haberdasher"
	"net/http"
	"os"
)

func main() {
	client := haberdasher.NewHaberdasherProtobufClient("http://localhost:8080", &http.Client{})

	hat, err := client.MakeHat(context.Background(), &haberdasher.Size{Inches: 12})
	if err != nil {
		fmt.Printf("oh no: %v", err)
		os.Exit(1)
	}
	fmt.Printf("I have a nice new hat: %+v", hat)
}