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

x/vgo: version incorrectly assumed as v1 instead of v2 #24384

Closed
IngCr3at1on opened this issue Mar 14, 2018 · 3 comments
Closed

x/vgo: version incorrectly assumed as v1 instead of v2 #24384

IngCr3at1on opened this issue Mar 14, 2018 · 3 comments
Milestone

Comments

@IngCr3at1on
Copy link

IngCr3at1on commented Mar 14, 2018

What version of Go are you using (go version)?

go1.10

What operating system and processor architecture are you using (go env)?

linux/amd64

What did you do?

I added a go.mod file to an existing project and ran vgo build. After correcting a missing dependency the following require lines are present.

require (
    "github.com/labstack/echo" v1.4.4
    "github.com/sirupsen/logrus" v1.0.5
    "golang.org/x/crypto" v0.0.0-20180312195533-182114d58262
    "golang.org/x/sys" v0.0.0-20180313075820-8c0ece68c283
)

What did you expect to see?

the application to be compiled into a binary

What did you see instead?

compile errors regarding:
v1.POST undefined (type *echo.Group has no field or method POST, but does have Post)
e.Start undefined (type *echo.Echo has no field or method Start)

This was weird to me at first because I knew that echo had a POST function on it's groups. Checked though and noticed that I'm using Echo v2 not v1 while vgo fetched v1 as the dependency.

the import path is obviously "github.com/labstack/echo", note that v1 does exist in the code as the name for the echo.Group that the POST endpoint in the first error is attached to.

vgo list -m -u shows echo as current (cause for v1 it is)

github.com/labstack/echo                  v1.4.4 (2016-11-03 12:41)           -
github.com/labstack/gommon                v0.0.0-20160609003227-722aa12d41c2  v0.2.1 (2017-05-06 11:25)
---
gopkg.in/labstack/echo.v1                 v0.0.0-20160603145024-be5efe592720  v1.4.4-gopkgin-v1.4.4 (2016-11-03 12:41)

Attempting to upgrade has interesting behavior as well:

$ vgo get github.com/labstack/echo@v3.2.1                                                                                                                  
vgo: finding github.com/labstack/echo v3.2.1
vgo: finding github.com/labstack/echo v3.2.1
vgo get: parsing downloaded go.mod: go.mod:7: invalid module: github.com/dgrijalva/jwt-go should be v1, not v3 (v3.0.0)
$ vgo get github.com/dgrijalva/jwt-go                                                                                                                      
vgo: finding github.com/dgrijalva/jwt-go v1.0.2
vgo: downloading github.com/dgrijalva/jwt-go v1.0.2
$ vgo get github.com/labstack/echo@v3.2.1                                                                                                                  
vgo: finding github.com/labstack/echo v3.2.1
vgo: finding github.com/labstack/echo v3.2.1
vgo get: parsing downloaded go.mod: go.mod:7: invalid module: github.com/dgrijalva/jwt-go should be v1, not v3 (v3.0.0)
@gopherbot gopherbot added this to the vgo milestone Mar 14, 2018
@AlexRouSg
Copy link
Contributor

vgo only allows v2+ when there is a go.mod file so please tell the package maintainer/owner to make the package vgo compatible.

@IngCr3at1on
Copy link
Author

@AlexRouSg or better yet, I can just pull request it instead of asking someone else to do it for me ;)

Thanks!

@AlexRouSg
Copy link
Contributor

AlexRouSg commented Mar 14, 2018

The package also may need modifications to completely support vgo, as vgo allows v1 and v2+ to be used together. So for singletons there will be 2+ instances. Hence why vgo forces you to have a go.mod file for v2+.

@golang golang locked and limited conversation to collaborators Mar 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants