samsarahq / thunder

⚡️ A Go framework for rapidly building powerful graphql services
https://godoc.org/github.com/samsarahq/thunder
MIT License
1.58k stars 116 forks source link

Error on livesql binlog.go #364

Open soniyj opened 4 years ago

soniyj commented 4 years ago

Hello tried to follow the steps in your example at

https://github.com/samsarahq/thunder/tree/master/example

But got an error while getting the module

thunder@v0.5.0/livesql/binlog.go:108:3: cannot use &replication.BinlogSyncerConfig literal (type *replication.BinlogSyncerConfig) as type replication.BinlogSyncerConfig in argument to replication.NewBinlogSyncer

I would like to use your framework in one of our projects, would you mind to have a look?

Thanks.

jrcichra commented 4 years ago

Just hit the same issue. go.mod:

module github.com/jrcichra/loxodonta/server

go 1.15

require (
    github.com/go-sql-driver/mysql v1.5.0 // indirect
    github.com/gogo/protobuf v1.3.1 // indirect
    github.com/gorilla/websocket v1.4.2 // indirect
    github.com/graphql-go/graphql v0.7.9 // indirect
    github.com/rakyll/statik v0.1.7 // indirect
    github.com/samsarahq/go v0.0.0-20191220233105-8077c9fbaed5 // indirect
    github.com/samsarahq/thunder v0.5.0
    github.com/siddontang/go-mysql v1.1.0 // indirect
    golang.org/x/sync v0.0.0-20200930132711-30421366ff76 // indirect
)
jrcichra commented 4 years ago

Looks like this project runs CI against Go 1.10.

I tried porting it to Go modules / Go 1.15 but ran into several issues once I got it moved / deleted vendor.

justin@justin-3900x:~/git/loxodonta/server$ go build
package github.com/jrcichra/loxodonta/server
    imports github.com/jrcichra/thunder/graphql/schemabuilder
    ../../../go/pkg/mod/github.com/jrcichra/thunder@v0.5.1-0.20201007035304-f56fb1d2f331/graphql/schemabuilder/input.go:12:2: use of internal package github.com/samsarahq/thunder/internal not allowed
package github.com/jrcichra/loxodonta/server
    imports github.com/jrcichra/thunder/livesql
    ../../../go/pkg/mod/github.com/jrcichra/thunder@v0.5.1-0.20201007035304-f56fb1d2f331/livesql/marshal.go:10:2: use of internal package github.com/samsarahq/thunder/internal/fields not allowed
jrcichra commented 4 years ago

@soniyj If this is still relevant to you, go ahead and try my fork:

go get github.com/jrcichra/thunder@c82d2fa57e8a14f2e6d7ff76b4ad583d5058134d

I changed around the syntax in the problem area until I could get it to compile in my Go 1.15 project which uses this lib.

And change the username to mine: jrcichra. I made a PR to hopefully to help understand why this is an issue. The code Go is complaining about looks correct to me; although I'm not very experienced with Go pre-modules.

soniyj commented 4 years ago

hello @jrcichra thanks for the answer after such a long time.

Yes it is as soon as I have time I will check it.

Thanks

amonks commented 3 years ago

I don't know about this bug in particular, but for what it's worth, we are using 4e12de31aec95543509591db85c65fd5fe6d8ea7 successfully with go 1.15, but we vendor all our go modules, so your mileage may vary:

go 1.15

replace github.com/samsarahq/thunder => ./vendor/github.com/samsarahq/thunder

We should definitely update the CI target. I'll see if I can get that done.


EDIT: updating CI target to 1.15 in https://github.com/samsarahq/thunder/pull/450.