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

Readme seems to be confusing regarding versions #1292

Closed
rmasclef opened this issue Feb 24, 2019 · 7 comments
Closed

Readme seems to be confusing regarding versions #1292

rmasclef opened this issue Feb 24, 2019 · 7 comments
Assignees
Labels

Comments

@rmasclef
Copy link

Issue Description

As of version 4.0.0, Echo is available as a Go module. Therefore a Go version capable of understanding /vN suffixed imports is required
1.9.7+
1.10.3+
1.11+

That can be undestood as

you can use v4 with go version > 1.9.7

Expected behaviour

import github.com/labstack/echo/v4 using dep actually imports v4 version

Actual behaviour

Solving failure: No versions of github.com/labstack/echo met constraints:
	v4.0.0: Could not introduce github.com/labstack/echo@v4.0.0, as its subpackage github.com/labstack/echo/v4/middleware is missing. (Package is required by (root).)
	v3.3.10: Could not introduce github.com/labstack/echo@v3.3.10, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.3.9: Could not introduce github.com/labstack/echo@v3.3.9, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.3.8: Could not introduce github.com/labstack/echo@v3.3.8, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.3.7: Could not introduce github.com/labstack/echo@v3.3.7, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.3.6: Could not introduce github.com/labstack/echo@v3.3.6, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.3.5: Could not introduce github.com/labstack/echo@v3.3.5, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	3.3.4: Could not introduce github.com/labstack/echo@3.3.4, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.3.4: Could not introduce github.com/labstack/echo@v3.3.4, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.3.3: Could not introduce github.com/labstack/echo@v3.3.3, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	3.3.3: Could not introduce github.com/labstack/echo@3.3.3, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.3.2: Could not introduce github.com/labstack/echo@v3.3.2, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	3.3.2: Could not introduce github.com/labstack/echo@3.3.2, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	3.3.1: Could not introduce github.com/labstack/echo@3.3.1, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.3.1: Could not introduce github.com/labstack/echo@v3.3.1, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	3.3.0: Could not introduce github.com/labstack/echo@3.3.0, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.3.0: Could not introduce github.com/labstack/echo@v3.3.0, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	3.2.6: Could not introduce github.com/labstack/echo@3.2.6, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.2.6: Could not introduce github.com/labstack/echo@v3.2.6, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.2.5: Could not introduce github.com/labstack/echo@v3.2.5, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	3.2.5: Could not introduce github.com/labstack/echo@3.2.5, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.2.4: Could not introduce github.com/labstack/echo@v3.2.4, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	3.2.4: Could not introduce github.com/labstack/echo@3.2.4, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	3.2.3: Could not introduce github.com/labstack/echo@3.2.3, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.2.3: Could not introduce github.com/labstack/echo@v3.2.3, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.2.2: Could not introduce github.com/labstack/echo@v3.2.2, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	3.2.2: Could not introduce github.com/labstack/echo@3.2.2, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.2.1: Could not introduce github.com/labstack/echo@v3.2.1, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.2.0: Could not introduce github.com/labstack/echo@v3.2.0, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.1.0: Could not introduce github.com/labstack/echo@v3.1.0, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.0.3: Could not introduce github.com/labstack/echo@v3.0.3, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.0.2: Could not introduce github.com/labstack/echo@v3.0.2, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.0.1: Could not introduce github.com/labstack/echo@v3.0.1, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.0.0: Could not introduce github.com/labstack/echo@v3.0.0, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v2.2.0: Could not introduce github.com/labstack/echo@v2.2.0, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v2.1: Could not introduce github.com/labstack/echo@v2.1, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v2.0.2: Could not introduce github.com/labstack/echo@v2.0.2, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v2.0.1: Could not introduce github.com/labstack/echo@v2.0.1, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v2.0.0: Could not introduce github.com/labstack/echo@v2.0.0, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v1.4.4: Could not introduce github.com/labstack/echo@v1.4.4, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v1.4.3: Could not introduce github.com/labstack/echo@v1.4.3, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v1.4.2: Could not introduce github.com/labstack/echo@v1.4.2, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v1.4.1: Could not introduce github.com/labstack/echo@v1.4.1, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v1.4: Could not introduce github.com/labstack/echo@v1.4, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v1.3: Could not introduce github.com/labstack/echo@v1.3, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v1.2.0: Could not introduce github.com/labstack/echo@v1.2.0, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v1.1.0: Could not introduce github.com/labstack/echo@v1.1.0, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v1.0.0: Could not introduce github.com/labstack/echo@v1.0.0, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.16: Could not introduce github.com/labstack/echo@v0.0.16, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.15: Could not introduce github.com/labstack/echo@v0.0.15, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.14: Could not introduce github.com/labstack/echo@v0.0.14, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.13: Could not introduce github.com/labstack/echo@v0.0.13, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.12: Could not introduce github.com/labstack/echo@v0.0.12, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.11: Could not introduce github.com/labstack/echo@v0.0.11, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.10: Could not introduce github.com/labstack/echo@v0.0.10, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.9: Could not introduce github.com/labstack/echo@v0.0.9, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.8: Could not introduce github.com/labstack/echo@v0.0.8, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.7: Could not introduce github.com/labstack/echo@v0.0.7, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.6: Could not introduce github.com/labstack/echo@v0.0.6, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.5: Could not introduce github.com/labstack/echo@v0.0.5, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.4: Could not introduce github.com/labstack/echo@v0.0.4, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.3: Could not introduce github.com/labstack/echo@v0.0.3, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v0.0.2: Could not introduce github.com/labstack/echo@v0.0.2, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.3.8-retag: Could not introduce github.com/labstack/echo@v3.3.8-retag, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.3.7-retag: Could not introduce github.com/labstack/echo@v3.3.7-retag, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.3.6-retag: Could not introduce github.com/labstack/echo@v3.3.6-retag, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.3.5-retag: Could not introduce github.com/labstack/echo@v3.3.5-retag, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.1.0-rc.1: Could not introduce github.com/labstack/echo@v3.1.0-rc.1, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.0.0-beta.3: Could not introduce github.com/labstack/echo@v3.0.0-beta.3, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.0.0-beta.2: Could not introduce github.com/labstack/echo@v3.0.0-beta.2, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v3.0.0-beta.1: Could not introduce github.com/labstack/echo@v3.0.0-beta.1, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v2.0.0-beta.2: Could not introduce github.com/labstack/echo@v2.0.0-beta.2, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v2.0.0-beta.1: Could not introduce github.com/labstack/echo@v2.0.0-beta.1, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v2.0.0-apha1: Could not introduce github.com/labstack/echo@v2.0.0-apha1, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v2.0.0-apha.2: Could not introduce github.com/labstack/echo@v2.0.0-apha.2, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v2.0.0-apha.1: Could not introduce github.com/labstack/echo@v2.0.0-apha.1, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	2.0.0-alpha: Could not introduce github.com/labstack/echo@2.0.0-alpha, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	master: Could not introduce github.com/labstack/echo@master, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v1: Could not introduce github.com/labstack/echo@v1, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.
	v2: Could not introduce github.com/labstack/echo@v2, as it is not allowed by constraint ^4.0.0 from project github.com/rmasclef/awesomeProject.

Steps to reproduce

Gopkg.toml

[prune]
  go-tests = true
  unused-packages = true

[[constraint]]
  name = "github.com/labstack/echo"
  version = "^4.0"

main.go

package main

import (
	"net/http"

	"github.com/labstack/echo/v4"
	"github.com/labstack/echo/v4/middleware"
)

func main() {
	// Echo instance
	e := echo.New()

	// Middleware
	e.Use(middleware.Logger())
	e.Use(middleware.Recover())

	// Routes
	e.GET("/", hello)

	// Start server
	e.Logger.Fatal(e.Start(":1323"))
}

// Handler
func hello(c echo.Context) error {
	return c.String(http.StatusOK, "Hello, World!")
}

Version/commit

  • go version : 1.11.5 darwin/amd64
  • gomodules: disabled
@rmasclef
Copy link
Author

Maybe this is the expected (v4 can not be used without gomodules)

If so, I suggest updating the README.md in order to be clearer 👍

@alexaandru
Copy link
Contributor

The README simply copied those notes about the versions from the official documentation, we did not come up with them on our own: https://github.com/golang/go/wiki/Modules#non-module-code-consuming-modules

As you can see here: https://golang.org/doc/devel/release.html#go1.9.minor and here: https://go.googlesource.com/go/+/d4e21288e444d3ffd30d1a0737f15ea3fc3b8ad9 they clearly did backport some functionality to that version (and I assume the same for 1.10.3 though I did not check) in order to have it work with Go modules.

That being said, while those versions do work with latest Echo just fine, there is indeed a mistake in the README in the sense that you cannot import it as v4, but have to use the regular import (without v4) suffix, which WILL in fact bring you the latest version of the library.

$ go version
go version go1.9.7 linux/amd64

$ cat x.go 
package main

import "github.com/labstack/echo"
import m "github.com/labstack/echo/middleware"

func main() {
	println(echo.Version)
	_ = m.CSRFConfig{}
}

$ go run x.go 
4.0.0

As you can see, latest Echo of version, including middleware, worked just fine with Go 1.9.7 in spite of the fact that internally (the middleware package) uses echo/v4 imports. I will make the clarification about the import path for older Go versions, vs new ones though, to make it clearer.


Now whether you can lock the vN version of a Go module package from another dependency manager, that is entirely a question for the respective dependency manager, a question that was in fact asked already here: golang/dep#1962

Hope this helps!

@rmasclef
Copy link
Author

Thank you for that answer 👍

As you said, after the README update, the problem will be, indeed, in the dependency manager side.

So regarding dep:

  • adding a dependency constraint on v4 will "not work".
  • Adding no constraint (or a constraint on master branch) will "work".

I don't know if it is a good idea but, as a lot of go devs use dep, maybe it will be nice to add this behavior as a warning or something like this in the README ?

@rmasclef
Copy link
Author

to me a simple change from this :

Any of these versions will allow you to import Echo as github.com/labstack/echo/v4 which is the recommended way of using Echo going forward.

to this:

Any of these versions will allow you to import Echo as github.com/labstack/echo/v4 using gomodule which is the recommended way of using Echo going forward.
For older versions or if you are not using gomodules yet, use the latest v3 tag

it might be nothing but, imho, it is way clearer like this 👍

@stale
Copy link

stale bot commented Apr 28, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 28, 2019
@stale stale bot closed this as completed May 6, 2019
@nebiros
Copy link

nebiros commented Jun 19, 2019

Honestly, this change screw many people, like me, suffix are not supported by other tools, don't get me wrong, go mod is the future, but not all packages/dependencies are migrated yet, so basically I would be pinned to a v3 tag until everybody migrates their packages to go mod. I don't see a real benefit on adding that

@nebiros
Copy link

nebiros commented Jun 19, 2019

Thank you for that answer 👍

As you said, after the README update, the problem will be, indeed, in the dependency manager side.

So regarding dep:

  • adding a dependency constraint on v4 will "not work".
  • Adding no constraint (or a constraint on master branch) will "work".

I don't know if it is a good idea but, as a lot of go devs use dep, maybe it will be nice to add this behavior as a warning or something like this in the README ?

pin to master doesn't work, cause middleware package is using /v4 suffix

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

No branches or pull requests

3 participants