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

Comments

@client9
Copy link

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 label Apr 27, 2018

@oiooj

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

commented Apr 28, 2018

@ufoscout

This comment has been minimized.

Copy link

commented Apr 30, 2018

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

This comment has been minimized.

Copy link

commented Apr 30, 2018

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

This comment has been minimized.

Copy link
Member

commented Apr 30, 2018

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

@bcmills

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented May 3, 2018

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

This comment has been minimized.

Copy link
Member

commented May 22, 2018

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

@client9

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link
Member

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 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.
Projects
None yet
7 participants
You can’t perform that action at this time.