go communicates with php as a server. The server code is as follows: s.go
package main
import (
"hello/world"
"fmt"
"git.apache.org/thrift.git/lib/go/thrift"
)
const (
NetworkAddr = "0.0.0.0:10086"
)
type helloThrift struct {
}
func (this *helloThrift) HelloName(name string) (string,err){
return (name + "111"),nil;
}
func main() {
transportFactory := thrift.NewTFramedTransportFactory(thrift.NewTTransportFactory())
protocolFactory := thrift.NewTBinaryProtocolFactoryDefault()
//protocolFactory := thrift.NewTCompactProtocolFactory()
serverTransport, err := thrift.NewTServerSocket(NetworkAddr)
if err != nil {
fmt.Println("Error!", err)
os.Exit(1)
}
handler := &idoallThrift{}
processor := HelloWorld.NewHelloWorldProcessor(handler)
server := thrift.NewTSimpleServer4(processor, serverTransport, transportFactory, protocolFactory)
fmt.Println("thrift server in", NetworkAddr)
server.Serve()
}
execute go run s.go
but the error is as follows:
-sharp hello/world
hello/world/helloworld.go:77:20: not enough arguments in call to oprot.Flush
have ()
want (context.Context)
hello/world/helloworld.go:101:15: cannot assign 1 values to 2 variables
hello/world/helloworld.go:147:34: cannot use helloWorldProcessorHelloName literal (type *helloWorldProcessorHelloName) as type thrift.TProcessorFunction in assignment:
*helloWorldProcessorHelloName does not implement thrift.TProcessorFunction (wrong type for Process method)
have Process(int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
want Process(context.Context, int32, thrift.TProtocol, thrift.TProtocol) (bool, thrift.TException)
hello/world/helloworld.go:157:27: not enough arguments in call to processor.Process
have (int32, thrift.TProtocol, thrift.TProtocol)
want (context.Context, int32, thrift.TProtocol, thrift.TProtocol)
hello/world/helloworld.go:165:13: not enough arguments in call to oprot.Flush
have ()
want (context.Context)
hello/world/helloworld.go:182:14: not enough arguments in call to oprot.Flush
have ()
want (context.Context)
hello/world/helloworld.go:195:14: not enough arguments in call to oprot.Flush
have ()
want (context.Context)
hello/world/helloworld.go:209:23: not enough arguments in call to oprot.Flush
have ()
want (context.Context)
has anyone ever encountered this problem? Hello/world/helloworld.go is generated through thrift.