-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
go mod vendor with replace cannot find revision referring to Git tag #35878
Comments
The module |
Why does |
@heschik are you saying that just for the versions that reference Git tags, this:
would need to be this instead?
that seems odd to me... |
From reading the multi-module repo literature, it seems that Kubernetes will need to add a whole bunch of Git tags, one for each Go submodule in the github.com/kubernetes/kubernetes/staging/src/ directory. Furthermore, we will need to create Git tags every time any of those Go submodules is changed during auto-generation of the staging directories... |
Because that doesn't need any tags at all; pseudoversions apply to the whole repository. Yes, if you wanted this to work you would need a tag for each module in the repository for each version. |
Had a conversation with a Kubernetes developer (@liggitt) and he gave me some insights on how we might rework our dependencies on staging submodules in the k/k tree (basically, don't depend on any of those submodules ;) ). Closing this out since it's clearly by design and not something wrong with go mod. |
to use the components under k8s.io/kubernetes/staging/... reference the published repositories and tags directly, don't try to use replace directives to point inside the staging dirs. you can depend on those directly using just require directives. if you also need to use k8s.io/kubernetes as a library (which is not recommended/supported), you will need to use replace directives to tell go how to locate all the components within its staging dir. to find the versions to use, you can run this inside the k8s.io/kubernetes/staging/src dir (the example here finds the SHAs for the kubernetes-1.17.0-rc.1 tag): ls | xargs -n 1 -I{} bash -c "curl -s https://proxy.golang.org/k8s.io/{}/@v/kubernetes-1.17.0-rc.1.info | jq -r '\"replace k8s.io/{} => k8s.io/{} \(.Version)\"'"
|
There's also work in progress to add semver tags to the published repos to make it easier to grab the versions that correspond to a given kubernetes release, see kubernetes/enhancements#1350 for details |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Unknown. Cannot test with latest Go release.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Ran
go mod vendor
with the followinggo.mod
file which uses the "v1.17.0-rc.1" semver tag for therequire
pinning of thek8s.io/kubernetes
module:(snipped for brevity)
which produces an error:
Please note that the
v1.17.0-rc.1
tag corresponds to an actual Git commit:However, if I attempt to pin the
k8s.io/kubernetes
require
entry to a pseudoversion that corresponds to a Git commit that is not referenced to a Git tag, everything works perfectly well:A
go.mod
with the pseudoversionrequire
entry that points to a non-tag-referenced Git commit:then
go mod vendor
runs perfectly fine.What did you expect to see?
Expected
go mod vendor
to be able to properly resolved semver-taggedrequire
orreplace
entries.The text was updated successfully, but these errors were encountered: