September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
26
Task/Distributed-programming/Go/distributed-programming-5.go
Normal file
26
Task/Distributed-programming/Go/distributed-programming-5.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
|
||||
"taxcomputer"
|
||||
)
|
||||
|
||||
func main() {
|
||||
conn, err := grpc.Dial("localhost:1234", grpc.WithInsecure())
|
||||
if err != nil {
|
||||
grpclog.Fatalf(err.Error())
|
||||
}
|
||||
defer conn.Close()
|
||||
client := taxcomputer.NewTaxComputerClient(conn)
|
||||
amt := &taxcomputer.Amount{300}
|
||||
tax, err := client.Tax(context.Background(), amt)
|
||||
if err != nil {
|
||||
grpclog.Fatalf(err.Error())
|
||||
}
|
||||
fmt.Println("Tax on", amt.Cents, "cents is", tax.Cents, "cents")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue