September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
30
Task/Distributed-programming/Go/distributed-programming-8.go
Normal file
30
Task/Distributed-programming/Go/distributed-programming-8.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"git.apache.org/thrift.git/lib/go/thrift"
|
||||
|
||||
"gen-go/tax"
|
||||
)
|
||||
|
||||
func main() {
|
||||
transport, err := thrift.NewTSocket("localhost:3141")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := transport.Open(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
protoFac := thrift.NewTCompactProtocolFactory()
|
||||
client := tax.NewTaxServiceClientFactory(transport, protoFac)
|
||||
amt := int32(300)
|
||||
t, err := client.Tax(amt)
|
||||
if err != nil {
|
||||
log.Print(err)
|
||||
} else {
|
||||
fmt.Println("tax on", amt, "is", t)
|
||||
}
|
||||
transport.Close()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue