RichardKnop / machinery

Machinery is an asynchronous task queue/job queue based on distributed message passing.
Mozilla Public License 2.0
7.52k stars 914 forks source link

compile error: impossible type assertion #787

Open mzychaco opened 1 year ago

mzychaco commented 1 year ago

I got an error while I tring to compile my project with machinery/v1 Here is the log:


external/com_google_cloud_go_pubsub/message.go:42:42: impossible type assertion:
        *psAckHandler does not implement "cloud.google.com/go/internal/pubsub".AckHandler (missing OnAckWithResult method)
external/com_google_cloud_go_pubsub/message.go:70:27: cannot use ackh (type *psAckHandler) as type "cloud.google.com/go/internal/pubsub".AckHandler in argument to "cloud.google.com/go/internal/pubsub".NewMessage:
        *psAckHandler does not implement "cloud.google.com/go/internal/pubsub".AckHandler (missing OnAckWithResult method)
compilepkg: error running subcommand external/go_sdk/pkg/tool/linux_amd64/compile: exit status 2
Target //workflow/cmd:workflow failed to build

And then, I found that Machinery depends on cloud.google.com/go@v0.76.0, but my project depends on v0.105.0. The different between this two version is about a interface in cloud.google.com/go/internal/pubsub/message.go

type AckHandler interface {

        // both declare in  v0.76.0 and v0.105.0
    OnAck() 
    OnNack()

        // only declare in v0.105.0
    OnAckWithResult() *AckResult
    OnNackWithResult() *AckResult
}

What should I do with this error? Beg for reply, thanks a lot

kabelsea commented 1 year ago

you can replace broken dependency on go mod ... project has not been updated for a long time

replace (
    cloud.google.com/go/pubsub => cloud.google.com/go/pubsub v1.9.0 // bug on machinery
)
mrz1836 commented 1 year ago

Thanks @kabelsea that fixed my issue as well using that package in GoLand IDE