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

Comments

Projects
None yet
5 participants
@ucirello
Copy link
Contributor

ucirello commented Jul 28, 2018

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 this to the Go1.12 milestone Aug 3, 2018

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Aug 3, 2018

@bcmills

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

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 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

This comment has been minimized.

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 join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.