-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: the vendor/ folder should be kept up to date if present #29058
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
Comments
This by the way feels like a requirement of #27227, but I think that even if using |
Conversely, one of the most consistent use-cases I have heard for the We clearly do need to be able to verify the consistency of the |
I feel like the fact that I agree that existing packages should not be modified when using (I am very skeptical of the adoption of pre-commit hooks.) |
Ideally I would like the |
+1 on that. (Which I guess is a solution to #27227?) In that case it's even more natural to update |
Given #27227, it's not clear to me when we would update the That seems pretty subtle, though. |
Is the use case of Also, a lot of the community support for Personally I never liked using |
@bcmills I completely disagree with this and think this is a really bad idea. This may be ok for Google's workflow but would break lots of other company's. The |
@nomad-software I said I want to remove the flag, not the |
@bcmills Ok, I misunderstood but that still raises the question how do we build against the download cache or the |
Older dependency management programs (govendor, go dep, glide, etc) all overwrote the vendor directory unconditionally. This didn't prevent people from using it to experiment with changes to dependencies. Modules are a bit different because dependencies are updated implicitly as part of the build process, however I think that this simple rule: "if go.mod is changed run go mod vendor", would satisfy everyone. It would keep the vendor directory up to date with go.mod and let people make changes inside vendor. |
I've been looking into the details for #27227, and I tend to agree that it will make this proposal necessary as well. |
#33848 explicitly checks for consistency. For the reasons described in #30240 (comment), we should not update the |
Closing in favor of #33848. |
Using
go mod vendor
is great for backwards compatibility (and for self-contained builds), but it requires re-running every time any dependency changes. Multiple times now I have committed changes that I tested withGO11MODULES=on
, only to have them fail in CI where they rely onvendor/
.The
go
tool already updatesgo.mod
andgo.sum
when making builds, I believe it should do the same with thevendor/
folder if it's present, to avoid getting in an inconsistent state.An out of date
vendor/
folder feels like an entirely inconsistent and confusing state to be in, causing builds to unexpectedly fail only for certain users, with no advantages, so the tooling should probably just not let it happen. If a developer doesn't want to keep thevendor/
folder up to date, it should be deleted./cc @rsc @bcmills
The text was updated successfully, but these errors were encountered: