sessions icon indicating copy to clipboard operation
sessions copied to clipboard

pool type error

Open AlanChienYL opened this issue 7 years ago • 9 comments

I got issue as below

../../gin-contrib/sessions/redis/redis.go:51:42: cannot use pool (type *"github.com/garyburd/redigo/redis".Pool) as type *"github.com/gomodule/redigo/redis".Pool in argument to redistore.NewRediStoreWithPool

I notice that you have update github.com/garyburd/redigo to github.com/gomodule/redigo without update github.com/gin-contrib/session

AlanChienYL avatar Jun 27 '18 06:06 AlanChienYL

@AlanChienZoek Can't reproduce this issue. cay you show the more detail source code?

appleboy avatar Jun 27 '18 07:06 appleboy

https://github.com/gin-contrib/sessions/blob/master/redis/redis.go

The import still "github.com/garyburd/redigo/redis"

But it’s seems updated right?

AlanChienYL avatar Jun 27 '18 07:06 AlanChienYL

We don't use github.com/gomodule/redigo/redis package anymore.

appleboy avatar Jun 27 '18 07:06 appleboy

https://github.com/boj/redistore has updated to use github.com/gomodule/redigo/redis https://github.com/boj/redistore/commit/09f58f6ea7588cf406c8054296315d3810714ccd

henrynet avatar Jun 27 '18 07:06 henrynet

@appleboy

source code go version go1.10.3 windows/amd64

package main

import (
	"fmt"

	"github.com/gin-contrib/sessions"
	"github.com/gin-contrib/sessions/redis"
)

func main() {
	store, err := redis.NewStoreWithDB(10, "tcp", "127.0.0.1:6205", "root", 0, "[]byte(Secret)")

	if err != nil {
		fmt.Println("[APP-sesssion] connect session adapter fails.")
		panic(err)
	}

	sessionMiddleware := sessions.Sessions("session", store)
}

output

# path/to/my/package/vendor/github.com/gin-contrib/sessions/redis
vendor\github.com\gin-contrib\sessions\redis\redis.go:52:42: cannot use pool (type *"path/to/my/package/vendor/github.com/garyburd/redigo/redis".Pool) as type *"path/to/my/package/vendor/github.com/gomodule/redigo/redis".Pool in argument to redistore.NewRediStoreWithPool
exit status 2
Process exiting with code: 1

same problem, solved after updated redigo dependencies.

koukuko avatar Jul 10 '18 10:07 koukuko

Im also having this problem, mac os x, go 1.10+, setting up new project with session and session/redis, it isn't clear to me how we should know what dependencies to install if any for any given library. Does "go get" handle this or we should use a tool like "dep" ? Also what specific dependencies does this library require (to connect to redis or other) ?

go/src/github.com/gin-contrib/sessions/redis/redis.go:52:42: cannot use pool (type *"github.com/garyburd/redigo/redis".Pool) as type *"github.com/gomodule/redigo/redis".Pool in argument to redistore.NewRediStoreWithPool

@koukuko can you explain exactly what you did to resolve, this seems like major breaking issue....

bjm88 avatar Jul 16 '18 01:07 bjm88

I have come with the same issue with the error message below.It seems that you use two kinds of different redis library .One is "github.com/garyburd/redigo/redis", the other one is "github.com/gomodule/redigo/redis" which result in crash when projects build.

github.com/gin-contrib/sessions/redis

..\github.com\gin-contrib\sessions\redis\redis.go:52:42: cannot use pool (type *"github.com/garyburd/redigo/redis".Pool) as type *"github.com/gomodule/redigo/redis".Pool in argument to redistore.NewRediStoreWithPool

Compilation finished with exit code 2

jeffjiang0613 avatar Jul 18 '18 08:07 jeffjiang0613

If you are using dep, you might be running into this issue because dep is not grabbing the latest version (master) of github.com/boj/redistore. Add this to your Gopkg.toml:

[[override]]
  branch = "master"
  name = "github.com/boj/redistore"

Then run $ dep ensure and the problem should be fixed.

kzh avatar Aug 12 '18 08:08 kzh

If you are using dep, you might be running into this issue because dep is not grabbing the latest version (master) of github.com/boj/redistore. Add this to your Gopkg.toml:

[[override]]
  branch = "master"
  name = "github.com/boj/redistore"

Then run $ dep ensure and the problem should be fixed.

awesome 😄

ViolaTangxl avatar Feb 26 '20 17:02 ViolaTangxl