Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 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