Updates for best practices
According to [the wiki](https://github.com/twitchtv/twirp/wiki/Best-Practices)
This commit is contained in:
+3
-3
@@ -7,7 +7,7 @@ import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"mcquay.me/hwt"
|
||||
pb "mcquay.me/hwt/rpc/hwt"
|
||||
)
|
||||
|
||||
const usage = "hwtc [subject]"
|
||||
@@ -18,9 +18,9 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
c := hwt.NewHelloWorldProtobufClient("http://localhost:8080", &http.Client{})
|
||||
c := pb.NewHelloWorldProtobufClient("http://localhost:8080", &http.Client{})
|
||||
|
||||
resp, err := c.Hello(context.Background(), &hwt.HelloReq{Subject: strings.Join(os.Args[1:], " ")})
|
||||
resp, err := c.Hello(context.Background(), &pb.HelloReq{Subject: strings.Join(os.Args[1:], " ")})
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "hello: %v\n", err)
|
||||
os.Exit(1)
|
||||
|
||||
+2
-1
@@ -5,11 +5,12 @@ import (
|
||||
"net/http"
|
||||
|
||||
"mcquay.me/hwt"
|
||||
pb "mcquay.me/hwt/rpc/hwt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := &hwt.Server{}
|
||||
th := hwt.NewHelloWorldServer(s, nil)
|
||||
th := pb.NewHelloWorldServer(s, nil)
|
||||
if err := http.ListenAndServe(":8080", th); err != nil {
|
||||
log.Fatalf("listen and serve: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user