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: unclear error message with gopkg.in #25121

Closed
client9 opened this issue Apr 27, 2018 · 12 comments
Closed

x/vgo: unclear error message with gopkg.in #25121

client9 opened this issue Apr 27, 2018 · 12 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@client9
Copy link

client9 commented Apr 27, 2018

Doing a vgo build on a initial build (no or empty go.mod file) produced an error that is unclear what is being referred to:

vgo build

...

vgo: finding github.com/gohugoio/hugo v0.40.1
vgo: parsing downloaded go.mod: go.mod:58: invalid module: gopkg.in/yaml.v2 should be v1, not v2 (v2.2.1)

unfortunately I don't know what or which go.mod is being referred to. None is in the current directory, none is in gohugoio/hugo (unless I missed something!)

see also #24099 which talks about gopkg.in

vgo version
go version go1.10.1 darwin/amd64 vgo:2018-02-20.1

but was a fresh go get -u as of 2018-04-27

thank you.

n

@gopherbot gopherbot added this to the vgo milestone Apr 27, 2018
@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 27, 2018
@oiooj
Copy link
Member

oiooj commented Apr 28, 2018

Now module major version use / as a separator when parsing modfile.
such as github.com/oiooj/agent/v2.

Should we add . as a separator for compatibility with gopkg.in ?
such as gopkg.in/yaml.v2

But I don't think this is a good idea. Because domains use . as their separator.
such as service.v6.ifeng.com/api/client.v6

@rsc

@bcmills
Copy link
Contributor

bcmills commented Apr 28, 2018

@oiooj, see golang/vgo@84430ca.

@ufoscout
Copy link

I have the very same issue but I don't understand exactly what is the cause.
Is it because of the convention that the modules from version 2 should be in a "/2" subdirectory?
If yes, shouldn't it only be a "suggested convention"? What happens if I release v2 of a project but I don't want to change the structure of my repository?
I don't see any technical reason why this should be enforced, am I missing something?

@ufoscout
Copy link

The same issue is present for many libraries, e.g.:
vgo: parsing downloaded go.mod: go.mod:12: invalid module: gopkg.in/go-playground/validator.v8 should be v1, not v8 (v8.0.0-20160110003959-c193cecd124b)

Waiting for this to be fixed, is there a workaround for it?

@bcmills
Copy link
Contributor

bcmills commented Apr 30, 2018

@ufoscout What version of vgo are you seeing that at? The change for gopkg.in versioning is fairly recent.

@bcmills
Copy link
Contributor

bcmills commented Apr 30, 2018

What happens if I release v2 of a project but I don't want to change the structure of my repository?

See https://research.swtch.com/vgo-module. (Search for the section labeled “From Repository to Modules”.)

@coyle
Copy link

coyle commented Apr 30, 2018

I am getting the same error:

  1. Did a fresh go get -u -v golang.org/x/vgo as of 3:40est 4/30/2018
  2. run vgo build ./...
  3. vgo: errors parsing go.mod: invalid module: gopkg.in/yaml.v2 should be v1, not v2 (v2.2.1)

@ufoscout
Copy link

ufoscout commented May 1, 2018

@bcmills

What version of vgo are you seeing that at? The change for gopkg.in versioning is fairly recent.

I did this right now:

$ go get -u golang.org/x/vgo

$ vgo version
go version go1.10.1 linux/amd64 vgo:2018-02-20.1

$ vgo build
vgo: finding github.com/gin-contrib/static v0.0.0-20180301030858-73da7037e716
vgo: finding github.com/gin-gonic/gin v1.1.4
vgo: finding github.com/gin-gonic/gin v1.1.4
vgo: parsing downloaded go.mod: go.mod:12: invalid module: gopkg.in/go-playground/validator.v8 should be v1, not v8 (v8.0.0-20160110003959-c193cecd124b)

@klingtnet
Copy link

I can confirm the same issue for go-mgo/mgo:

vgo: parsing downloaded go.mod: go.mod:22: invalid module: gopkg.in/mgo.v2 should be v1, not v2 (v2.0.0-20160818020120-3f83fa500528)

@ALTree ALTree changed the title x/vgo unclear error message with gopkg.in x/vgo: unclear error message with gopkg.in May 4, 2018
@oiooj
Copy link
Member

oiooj commented May 22, 2018

vgo can not parsed modulepath correctly with gopkg.in before. This issue was fixed by CL 112277.

@client9
Copy link
Author

client9 commented May 22, 2018

@oiooj

The ticket is about the vague error message, not the functionality (which does appear to be working now... see #24099 ). I didn't see any fix for error messages like the following

vgo: parsing downloaded go.mod: go.mod:58: invalid module: ....

so it's clear which go.mod is the problem

@oiooj
Copy link
Member

oiooj commented May 22, 2018

@client9 Because vgo can not parsed modulepath correctly with gopkg.in, so you got the confused error message. No need to fix error message.

@oiooj oiooj closed this as completed Jun 1, 2018
@golang golang locked and limited conversation to collaborators Jun 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

7 participants