Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 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