uber-go / cadence-client

Framework for authoring workflows and activities running on top of the Cadence orchestration engine.
https://cadenceworkflow.io
MIT License
344 stars 130 forks source link

Trying to install the go.uber.org/cadence/workflow as part of building the project cadence-samples-master #523

Closed pranabhkumar closed 4 years ago

pranabhkumar commented 6 years ago

go.uber.org/cadence/internal/common

go/src/go.uber.org/cadence/internal/common/thrift_util.go:29:38: not enough arguments in call to thrift.NewTSerializer().Write have (thrift.TStruct) want (context.Context, thrift.TStruct) go/src/go.uber.org/cadence/internal/common/thrift_util.go:51:27: not enough arguments in call to t.Protocol.Flush have () want (context.Context) go/src/go.uber.org/cadence/internal/common/thrift_util.go:55:28: not enough arguments in call to t.Transport.Flush have () want (context.Context)

mfateev commented 6 years ago

It looks like the thrift compiler version is different. Here is mine:

~ maximfateev$ thrift --version Thrift version 0.9.3

dmetzgar commented 5 years ago

@pranabhkumar were you able to get past this issue?

xcaptain commented 5 years ago

Same problem here.

thrift --version
Thrift version 0.11.0

https://github.com/apache/thrift/blob/master/lib/go/thrift/serializer.go#L62 Write function takes 2 arguments but cadence passed only one

mfateev commented 5 years ago

We are using version 0.9.3 for compatibility with Uber internal tools.

mfateev commented 5 years ago

Here is the command to install that version on mac:

brew install https://gist.githubusercontent.com/chrislusf/8b4e7c19551ba220232f037b43c0eaf3/raw/01465b867b8ef9af7c7c3fa830c83666c825122d/thrift.rb && brew pin thrift

xcaptain commented 5 years ago

Thanks, git checkout to 0.9.3 of thrift worked for me, seems no need to change thrift compiler version.

rasouli commented 5 years ago

hi as described in the read me to use cadence-client when I perform: go get go.uber.org/cadence I encounter the same issue again (with go modules enabled and disabled, go version go1.11.10 linux/amd64) is checking out 0.9.3 version of the thrift lib residing in $GOPATH/src the final solution to this? shouldn't this be documented then as an extra step?

Thanks.

dmetzgar commented 5 years ago

@pranabhkumar, I've been working on updated documentation. The fix I found is to add the following to the Gopkg.toml:

[[override]]
  name = "github.com/apache/thrift"
  revision = "9549b25c77587b29be4e0b5c258221a4ed85d37a"
sevein commented 4 years ago

If you are using Go modules in your project, the top-level module (i.e. your project) can make use of the replace directive to determine the exact version to be used for a given dependency, e.g. Apache Thrift v0.9.x. That's been working well for me so far.

I'm going to share a quick example. I'm using Go v1.13 and my project wants to import this library. Running go build gives me the same error already shared above:

# go.uber.org/cadence/internal/common
../../go/pkg/mod/go.uber.org/cadence@v0.9.1/internal/common/thrift_util.go:29:38: not enough arguments in call to thrift.NewTSerializer().Write
    have (thrift.TStruct)
    want (context.Context, thrift.TStruct)
../../go/pkg/mod/go.uber.org/cadence@v0.9.1/internal/common/thrift_util.go:51:27: not enough arguments in call to t.Protocol.Flush
    have ()
    want (context.Context)
../../go/pkg/mod/go.uber.org/cadence@v0.9.1/internal/common/thrift_util.go:55:28: not enough arguments in call to t.Transport.Flush
    have ()
    want (context.Context)

I run go mod graph to discover that the module version being used is github.com/apache/thrift@v0.12.0 hence the conflict. I'm going to use go mod edit -replace to introduce the replace directive in my project pinning the dependency to the particular version that we want:

$ go mod edit -replace "github.com/apache/thrift=github.com/apache/thrift@a9b748bb0e02"
$ go mod tidy
go: finding github.com/apache/thrift a9b748bb0e02

I've used a9b748bb0e02 because Thrift's corresponding tag v0.9.3.1 isn't a valid semver version.

Now go build completes successfully. My go.mod file includes:

replace github.com/apache/thrift => github.com/apache/thrift v0.0.0-20190309152529-a9b748bb0e02
GowthamMS commented 4 years ago

If you are using go get follow these steps cd C:\Users\Gowtham.MS\go\src\github.com\apache\thrift git checkout 53dd39833a08 go get go.uber.org/cadence

Gurpartap commented 4 years ago
replace github.com/apache/thrift => github.com/apache/thrift v0.0.0-20190309152529-a9b748bb0e02

Is there a way to keep this hardcoded commit number in sync with the one actually being used by cadence (currently v0.0.0-20161221203622-b2a4d4ae21c7)? See go.mod.

frranck commented 4 years ago

Hello, Is it normal this problem is still occurring? replace does fix it though...

Groxx commented 3 years ago

As a very late update: this should be fixed whenever https://github.com/yarpc/yarpc-go/pull/2075 is merged (and we upgrade Cadence to it, which should be fairly soon after).

Users of glide or dep (or anything compatible with them) are currently pulling in yarpc's glide.yaml file, and that sets an upper bound of <0.11, which keeps apache/thrift compatible with cadence and yarpc / tchannel-go. Users of go modules pull in the incompatible 0.13 (or newer), and they get this error.

rafalmnich commented 2 years ago

Looks like yarpc is merged a while ago. Any updates here?