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: do not add refs to non-module v2.0.0 during go.mod auto-creation #24585

Closed
fishy opened this issue Mar 28, 2018 · 9 comments
Closed

x/vgo: do not add refs to non-module v2.0.0 during go.mod auto-creation #24585

fishy opened this issue Mar 28, 2018 · 9 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@fishy
Copy link

fishy commented Mar 28, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"

What did you do?

The repo to reproduce this issue is https://github.com/fishy/gcsbucket (at time of reporting, HEAD is at 618d60fe84e06f5e695a7be52566b40d198191a5). It imports cloud.google.com/go/storage (and also github.com/fishy/fsdb, but that one doesn't have any other 3rd party dependencies).

Running vgo build the first time builds successfully, generating go.mod file:

module "github.com/fishy/gcsbucket"

require (
        "cloud.google.com/go" v0.0.0-20180119154837-767c40d6a2e0
        "github.com/fishy/fsdb" v0.0.0-20180217030800-5527ded01371
        "github.com/golang/protobuf" v1.0.0
        "github.com/googleapis/gax-go" v2.0.0
        "golang.org/x/net" v0.0.0-20180216171745-136a25c244d3
        "golang.org/x/oauth2" v0.0.0-20180207181906-543e37812f10
        "golang.org/x/text" v0.0.0-20180208041248-4e4a3210bb54
        "google.golang.org/api" v0.0.0-20180217000815-c7a403bb5fe1
        "google.golang.org/appengine" v1.0.0
        "google.golang.org/genproto" v0.0.0-20180206005123-2b5a72b8730b
        "google.golang.org/grpc" v1.10.0
)

Then running vgo build again will complain about:

vgo: errors parsing go.mod:
/Users/fishy/work/gopath/src/github.com/fishy/gcsbucket/go.mod:7: invalid module: github.com/googleapis/gax-go should be v1, not v2 (v2.0.0)
@gopherbot gopherbot added this to the vgo milestone Mar 28, 2018
@fishy
Copy link
Author

fishy commented Mar 28, 2018

vgo version tested: 425260f20c6969ca9c30c7efe3c8019fddd3c416.

@AlexRouSg
Copy link
Contributor

vgo does not allow depending on packages >v1 without a go.mod file

@fishy
Copy link
Author

fishy commented Mar 28, 2018

To clarify, running vgo build without go.mod file will generate the file automatically, with v2.0.0 for github.com/googleapis/gax-go. Running vgo build with go.mod file it generated before will throw that error and refuse to build.

@AlexRouSg
Copy link
Contributor

Sorry I meant the dependency must have a go.mod file to use v2+
So you either have to get github.com/googleapis/gax-go to add a go.mod file or maybe try manually changing the version to v0.0.0-yyyymmddhhmmss-commit

@fishy
Copy link
Author

fishy commented Mar 28, 2018

In that case I think the proper fix should be that while generating go.mod file, use v0.0.0-yyyymmddhhmmss-commit instead of v2.0.0 when the target repository doesn't have go.mod file.

@AlexRouSg
Copy link
Contributor

Yeah, but I think a new bug report on that is better. Unless you want to try and repurpose this issue by changing the title and description.

@fishy fishy changed the title x/vgo: conflicting versions with github.com/googleapis/gax-go from importing cloud.google.com/go/storage x/vgo: While generating go.mod file, it should use v0.0.0-yyyymmddhhmmss-commit instead of v2.x when the target repo doesn't have go.mod file Mar 29, 2018
@fishy
Copy link
Author

fishy commented Mar 29, 2018

Title updated.

@rsc rsc changed the title x/vgo: While generating go.mod file, it should use v0.0.0-yyyymmddhhmmss-commit instead of v2.x when the target repo doesn't have go.mod file x/vgo: do not add refs to non-module v2.0.0 during go.mod auto-creation Mar 30, 2018
@rsc rsc added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 30, 2018
@rsc
Copy link
Contributor

rsc commented Mar 30, 2018

Yes, the problem is that the auto-converter for some reason decided to use v2.0.0 instead of a pseudo-commit.

@gopherbot
Copy link

Change https://golang.org/cl/107660 mentions this issue: cmd/go/internal/modfetch: fix conversion of legacy v2 versions

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

4 participants