gin-contrib/sessions

pool type error

AlanChienYL opened this issue · 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

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

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?

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

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

@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.

bjm88 commented

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....

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

kzh commented

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.

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 😄