xiaonanln / goworld

Scalable Distributed Game Server Engine with Hot Swapping in Golang
Apache License 2.0
2.53k stars 450 forks source link

kvdb_redis_cluster.go:36:3: cannot use c (type *redis.Cluster) as type redis.Cluster in field value #81

Closed eidng8 closed 4 years ago

eidng8 commented 4 years ago

Just me?

Hm, it's gone now, after run goworld build exmaples/unity_demo. Weird enough

eidng8 commented 4 years ago

I've tried this on another Ubuntu box, and it comes back again.

It's a newly setup Ubuntu 18 on WSL. I've created an empty directory, go in to it. Then do the following:

go get github.com/xiaonanln/goworld
go install github.com/xiaonanln/goworld/cmd/goworld
bin/goworld build examples/unity_demo

Then the error comes out again:

> arguments: build examples/unity_demo
> go search paths: /mnt/d/Trials/go/gw-chat:/mnt/e/Storage/Go
> goworld directory found: /mnt/d/Trials/go/gw-chat/src/github.com/xiaonanln/goworld
info    Using config file: /mnt/d/Trials/go/gw-chat/src/github.com/xiaonanln/goworld/goworld.ini        {"ts": "2019-12-13T15:23:53.297+0800"}
info    >>> config <<< debug = true     {"ts": "2019-12-13T15:23:53.299+0800"}
info    >>> config <<< desired dispatcher count = 1     {"ts": "2019-12-13T15:23:53.300+0800"}
info    >>> config <<< desired game count = 1   {"ts": "2019-12-13T15:23:53.304+0800"}
info    >>> config <<< desired gate count = 1   {"ts": "2019-12-13T15:23:53.306+0800"}
info    >>> config <<< storage type = redis     {"ts": "2019-12-13T15:23:53.307+0800"}
info    >>> config <<< KVDB type = redis        {"ts": "2019-12-13T15:23:53.307+0800"}
> building server examples/unity_demo ...
> server directory is /mnt/d/Trials/go/gw-chat/src/github.com/xiaonanln/goworld/examples/unity_demo ...
> go build examples/unity_demo ...
# github.com/xiaonanln/goworld/engine/kvdb/backend/kvdbrediscluster
../../engine/kvdb/backend/kvdbrediscluster/kvdb_redis_cluster.go:36:4: cannot use c (type *redis.Cluster) as type redis.Cluster in field value
# github.com/xiaonanln/goworld/engine/storage/backend/redis_cluster
../../engine/storage/backend/redis_cluster/entity_storage_redis_cluster.go:39:4: cannot use c (type *redis.Cluster) as type redis.Cluster in field value
! Failed to build /mnt/d/Trials/go/gw-chat/src/github.com/xiaonanln/goworld/examples/unity_demo: exit status 2

However, the same thing works fine in the Windows box.

eidng8 commented 4 years ago

The problem seems to be with modules.

On the Windows box, it builds using modules. The redis package used is:

%GOPATH%\pkg\mod\github.com\chasex\redis-go-cluster@v1.0.0\redis.go

And the function declaration is:

func NewCluster(options *Options) (Cluster, error)

On the Ubuntu box, it builds using raw srouce. The redis package used is:

$GOPATH/src/github.com/chasex/redis-go-cluster/cluster.go

And the function declaration is:

func NewCluster(options *Options) (*Cluster, error)
xiaonanln commented 4 years ago

Are you using master or release? Are you using dep or go mod?

This is all about redis cluster module version.

eidng8 commented 4 years ago

LOL, my fault again! Just notice I'm running on Go 1.10.