-
Notifications
You must be signed in to change notification settings - Fork 18k
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
cmd/go: module loader looks for the wrong tags if the "go-import" prefix includes the major-version suffix #30647
Comments
|
The issue template asks, “What did you do?” — please describe the concrete problem that you're trying to solve, and what you've actually tried so far. (Presumably you are not trying to use In particular, the “major subdirectory” convention described in https://research.swtch.com/vgo-module should work in both module mode and GOPATH mode without any modification of existing |
I note the following behavior from 'https://nanomsg.org` today:
The result of that second query seems to indicate that you're pointing the |
Actually, I think that second tag is the problem. I suspect that the
|
That error message comes from here:
That seems to imply that, for some reason, we're looking for a tag with the wrong prefix. |
There seem to be a couple of issues here: go/src/cmd/go/internal/modfetch/coderepo.go Lines 151 to 154 in 4e2b0dd
First, go/src/cmd/go/internal/modfetch/coderepo.go Line 264 in 4e2b0dd
Second, the computed |
As a workaround, you can probably remove the |
So the reason I called out rsc.io/quote was that this was used as an example to me. It would be helpful to have a working example. I want to use branch mode. The reason the repos for v2 are different is that I split for semver reasons before modules were a thing. I can merge back to one repo, once I'm certain that it works. The other thing is that v1 users have a totally different import path, not just a suffix that's different. I had originally planned to do a v3 version update, which would support both modules and go get, and could have a revised import path, with minimal disruptions ideally. It would still be helpful to me to have a demonstration repo (including vanity support) that showed both module and go get support combined with a v2+ semver, ideally using branching rather that directories to distinguish major versions. |
I think you might be asking for an example that works with a module consumer and non-module consumer? (Modules use |
I have some good news. I have a proof-of-concept fix that successfully fetches |
This would be excellent news! |
Change https://golang.org/cl/166117 mentions this issue: |
@gopherbot, please backport to 1.12: this fixes a regression from GOPATH mode and the patch is small. |
Backport issue(s) opened: #30665 (for 1.12). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Correct. I'm not sure how we refer to "non modules"... ;-p |
“GOPATH mode”. |
As of CL 166117, I tried to think of what sorts of examples we needed to illustrate, but there really isn't that much to it: a module with path
The bug affected the last of those cases in module mode. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?Windows, Linux, 64-bit
go env
OutputWhat did you do?
The easiest example is Russ Cox's rsc.io/quote package.
cd ~/go/
go get rsc.io/quote/v2
Also with v3, different error:
go get rsc.io/quote/v3
I'm trying to enable a package (nanomsg.org/go/mangos/v2 - with numerous sub package) for both modules and legacy mode. When I followed the example of rsc.io/quote for how to do this, I wound up breaking all my legacy users.
It might be possible to use vanity import paths, v2+ modules, in a way that works with both GO111MODULES=on and GO111MODULES=off, but after numerous days of effort trying to make this work, I am not convinced that it actually is possible. If it is possible, a working example would be helpful. If it isn't, it would be good to fix it, because this represents huge friction in adoption of go modules for me and my downstreams.
What did you expect to see?
go get works in $GOPATH
What did you see instead?
See above errors, go get fails differently, depending on whether Major Branches (my preferred approach!) or Major directories are used.
Note that things do work fine with GO111MODULES=on (or auto if not in $GOPATH).
The text was updated successfully, but these errors were encountered: