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

cmd/go: allow <meta> tags to override version tag prefixes for submodules #26664

Closed
ucirello opened this issue Jul 28, 2018 · 4 comments
Closed
Labels
FrozenDueToAge modules NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@ucirello
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10.3 linux/amd64 vgo:devel +88c76dcbab
go version go1.11beta2 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/uldericofilho/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/uldericofilho/src/strongdm"
GOPROXY=""
GORACE=""
GOROOT="/Users/uldericofilho/sdk/go1.11beta2"
GOTMPDIR=""
GOTOOLDIR="/Users/uldericofilho/sdk/go1.11beta2/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/uldericofilho/src/strongdm/src/github.com/ucirello/gomod-submod-bug/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_l/9yb78fmx0jzb8khycvrzw3qw0000gn/T/go-build292047428=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Reproduction script:
https://github.com/ucirello/gomod-submod-bug/blob/master/test.sh

Log at:
https://github.com/ucirello/gomod-submod-bug/blob/master/test.log

What did you expect to see?

When running go get, I expected to see cirello.io/errors@v1.1.8 to be imported instead of v0 placeholder.
When manually changing go.mod to require cirello.io v1.1.8, I would expect modules system to pull cirello.io@v1.1.8 and extract cirello.io/errors from it.

What did you see instead?

The builder breaks.

@oiooj oiooj added the modules label Jul 28, 2018
@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 3, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.12 milestone Aug 3, 2018
@ianlancetaylor
Copy link
Contributor

CC @bcmills

@bcmills
Copy link
Contributor

bcmills commented Aug 3, 2018

This is working as designed: see the “Multiple-Module Repositories” section of https://research.swtch.com/vgo-module.

The go command interprets the v1.1.8 tag on the repository github.com/ucirello/public as applying to the module github.com/ucirello/public. For the module stored in github.com/uricello/public/errors, we expect to see a repository tag with the prefix errors/, such as errors/v1.1.8.

Perhaps we could fall back to versions without a prefix if there are no versions tagged with the prefix, but then what happens if a prefixed tag is added later? If you added the tag errors/v1.0.0 to the revision tagged v1.1.8, then the meaning of cirello.io/errors@v1.0.0 would change: we certainly can't allow that.

@bcmills
Copy link
Contributor

bcmills commented Aug 3, 2018

Your use-case is interesting, though: you're using a <meta> HTML tag to point into the repository, not serving straight out of that repository. Perhaps we could allow the <meta> HTML tag to explicitly override the prefix that the go command uses for version tags.

I'll leave that for @rsc to decide.

@bcmills bcmills added NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Aug 3, 2018
@bcmills bcmills changed the title cmd/go: submodules do not inherit the tag of the parent module cmd/go: allow <meta> tags to override version tag prefixes for submodules Aug 3, 2018
@bcmills bcmills modified the milestones: Go1.12, Go1.13 Nov 15, 2018
@rsc
Copy link
Contributor

rsc commented Jan 17, 2019

Sorry, but this is working as intended.

I understand why you'd want to do that, but part of the design here is to allow a single repo to contain modules at different versions. If the repo corresponds to cirello.io (as in this case), then to tag a specific version of cirello.io/errors as v1.1.8, you need to create an errors/v1.1.8 tag.

And because there is an errors/go.mod file, the module cirello.io does not contain that directory. Modules do not contain other modules.

For all but power users, you probably want to adopt the usual convention that one repo = one module. It's important for long-term evolution of code storage options that a repo can contain multiple modules, but it's almost certainly not something you want to do by default. We will be writing a doc at some point about how and how not to arrange multiple modules in a single repo.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

6 participants