echo-contrib icon indicating copy to clipboard operation
echo-contrib copied to clipboard

cannot use session.Middleware

Open pyprism opened this issue 6 years ago • 3 comments

While I following official session example, it throws this error:

cannot use session.Middleware(sessions.NewCookieStore(([]byte)("secret"))) (type "github.com/labstack/echo/v4".MiddlewareFunc) as type "github.com/labstack/echo".MiddlewareFunc in argument to e.Use

here is the go.mod:

module github.com/pyprism/Proj

go 1.12

require (
	github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
	github.com/gorilla/sessions v1.2.0
	github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
	github.com/jinzhu/gorm v1.9.10
	github.com/labstack/echo v3.3.10+incompatible
	github.com/labstack/echo-contrib v0.6.0
	github.com/labstack/echo/v4 v4.1.11 // indirect
	github.com/lestrrat-go/file-rotatelogs v2.2.0+incompatible
	github.com/lestrrat-go/strftime v0.0.0-20190725011945-5c849dd2c51d // indirect
	github.com/sirupsen/logrus v1.2.0
	github.com/spf13/viper v1.4.0
	github.com/tebeka/strftime v0.1.3 // indirect
	golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
)

pyprism avatar Oct 07 '19 10:10 pyprism

@pyprism You need to use the following imports:

	"github.com/labstack/echo/v4"
	"github.com/labstack/echo-contrib/session"
	"github.com/labstack/echo/v4/middleware"

@vishr maybe we should update the docs at https://echo.labstack.com/middleware/session

I can take this up if help is needed

rhnvrm avatar Oct 30 '19 19:10 rhnvrm

@hsluoyz Help is always welcomed! 👍

vishr avatar Oct 30 '19 20:10 vishr

+1 still exists, cant use any of the middleware

rosscdh avatar Mar 07 '20 11:03 rosscdh

closing, old, wrong import used

aldas avatar May 23 '23 20:05 aldas