Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use with echo/v4 (Go Modules) #8

Closed
andradei opened this issue Feb 12, 2019 · 3 comments · Fixed by #9
Closed

Can't use with echo/v4 (Go Modules) #8

andradei opened this issue Feb 12, 2019 · 3 comments · Fixed by #9

Comments

@andradei
Copy link

andradei commented Feb 12, 2019

This project seems to not be able to be used when importing echo as github.com/labstack/echo/v4 with Go Modules.

package main

import (
	"github.com/gorilla/sessions"
	"github.com/labstack/echo-contrib/session"
	"github.com/labstack/echo/v4"
	"github.com/labstack/echo/v4/middleware"
)

func main() {
	e := echo.New()
	e.Renderer = &controller.Template{}
	e.Use(middleware.Logger())
       // Error here
	e.Use(session.Middleware(sessions.NewCookieStore([]byte("secret"))))

The error message is:

cannot use session.Middleware(sessions.NewCookieStore(([]byte)(\"secret\"))) (type \"github.com/labstack/echo\".MiddlewareFunc) as type \"github.com/labstack/echo/v4\".MiddlewareFunc in argument to e.Use
@andradei andradei changed the title Can't use in echo/v4 (Go Modules) Can't use with echo/v4 (Go Modules) Feb 12, 2019
@andradei
Copy link
Author

This should fix it:

  • go.mod
  • changing the imports to github.com/labstack/echo/v4
  • Having a v4.0.0 tag/release to accompany github.com/labstack/echo's move to v4.0.0

I can make a PR if this is approved.

@tarim
Copy link

tarim commented Dec 29, 2019

I have the same issue. How did you fix it, please?

@danieltanfh95
Copy link

go mod init <your-app-name>
go get github.com/labstack/echo/v4

@tarim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants