hwtc: host addr is required arg
This commit is contained in:
parent
039819c1f0
commit
9ccfd44724
@ -10,17 +10,17 @@ import (
|
|||||||
pb "mcquay.me/hwt/rpc/hwt"
|
pb "mcquay.me/hwt/rpc/hwt"
|
||||||
)
|
)
|
||||||
|
|
||||||
const usage = "hwtc [subject]"
|
const usage = "hwtc <server address> [subject]"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if len(os.Args) < 2 {
|
if len(os.Args) < 3 {
|
||||||
fmt.Fprintf(os.Stderr, "%v\n", usage)
|
fmt.Fprintf(os.Stderr, "%v\n", usage)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
c := pb.NewHelloWorldProtobufClient("http://localhost:8080", &http.Client{})
|
c := pb.NewHelloWorldProtobufClient(fmt.Sprintf("http://%s", os.Args[1]), &http.Client{})
|
||||||
|
|
||||||
resp, err := c.Hello(context.Background(), &pb.HelloReq{Subject: strings.Join(os.Args[1:], " ")})
|
resp, err := c.Hello(context.Background(), &pb.HelloReq{Subject: strings.Join(os.Args[2:], " ")})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "hello: %v\n", err)
|
fmt.Fprintf(os.Stderr, "hello: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user