-
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
cmd/go: {get|build|install} need to improve behaviors with vendor directory. #44841
Comments
Basically the way I work around this is by providing an extra command that sets all of the flags appropriately, and then just asking everyone to run vendor:
envdir envs/localdev go mod vendor && envdir envs/localdev go mod tidy And then envs/localdev contains
in particular |
I'm not saying this is a good solution, it took a while to get there, but having it has simplified working with the vendor directory pretty well. |
@kevinburkemeter appreciate the workaround, looking for the discussion on how we as a community can fix the tool so it can provide a great experience out of the box without twiddling bits and bobs for the basic use cases. there is also a fundamental tooling problem underlying all of these issues which i don't think has been addressed @rsc touches on it in that thread I linked. |
That was an intentional decision resulting from the discussion in #30240 (see #30240 (comment) for a summary); see also #29058 and #38222. The final design as implemented was #33848. |
The Note that |
That should never be the case when When vendoring is in use, the only times the If you find that a |
As far as I am aware, no one on the Go project is claiming that modules will allow for removing vendor support. (If we were planning to remove it, we would not have bothered to implement #33848!) Per the Background section on #33848:
|
Sorry, but that is not feasible. The However, note that with |
Regarding the environment variables:
These variables do admittedly add complexity. However,
The default value for
( |
As far as I can tell, many of the points here were either addressed, or explicitly considered and rejected, in #33848. In order to revisit the behaviors rejected for #33848, we would need to see new information (something not already considered in the design and decisions for that proposal, such as a failure mode or mode of use that we were not aware of at the time), and probably also a concrete proposal of what to do differently. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@bcmills i'll get around to responding hopefully next weekend. but i think the problem with refering to #33848 is i believe the go team it making fundamental mistakes w/ respect to go modules that make it harder to work with golang tooling and defeating some of the main benefits to the tooling. the last few releases I've run into more and more problems with the tooling than at anytime in the 4 years prior. and the problems start with how packages are resolved (and particularly the lack of a library for dealing with them), and progress into how all these commands interact with modules. basically my intuition is telling me that the go team is taking a remote first approach to the resolution vs a local filesystem first approach. which is the source of most of the ergonomics of problems with vendoring. (-mod=vendor is a hack and unintuitive solution and dare I say it entirely unnecessary) and with the replace directive. i'm particularly frustrated with the fact other attempts at addressing specific problems have been rejected out of hand because the goteam thinks they've considered the problem and 'solved' them. usually by saying 'we'll deal with it late if it comes up' and when it does come up 'we've already considered and rejected that its problem' despite the fact it is a problem and sometimes regressions from previous behavior. I believe I have some ideas to addressing the issues without causing any major issues going forward. but means the go team needs to take a step back and listen vs decreeing that they've 'already considered the issue' |
@bcmills sorry for the huge delay in response. I just don't have the time to hand hold this issue I wish i could but life. i do have a repository that doesn't build cleanly anymore due to go go modules treats replace directives and vendoring dependencies. you can use as an example. unfortunately due to upstream motivations and I believe security issues its unlikely that the changes needed to support my use of said library will ever allow me to pull in upstream. i'm likely going to hard fork the dependency at some point as a result of lack of forward movement on this issue and #40053. |
the one thing I forgot to mention was my idea for solving the issues presented is predicated on turning vendor directory into a go mod cache, identical to the global one so instead of golang tooling looking at the global cache it'll only consider the modules stored in vendor. the go.sum would need to keep the quad tuple (mod name, version/go.mod, repository source, checksum) for the replace directive to work properly. as the source repository is important when after that I'd move a bunch of the environment variables out into configuration files that live in GOMODCACHE (or go.mod directly) allowing for tooling to pick them up directly and per module. ideally with a settings that disables all network access outside of explicitly updating and adding modules for #40053. |
It is not feasible to change the It does not seem necessary to expand or redefine the Go module cache for this use-case: we already have the four data you mention; they're just encoded slightly differently than you suggest. Specifically:
|
You say you've “run into more and more problems with the tooling than at anytime in the 4 years prior”, but again, I haven't seen new, concrete information here. If you want us to change the (#47109 has no apparent connection to the |
@bcmills seems like we're talking past each other. my point was holistically the tooling has had a very degraded experience with things just not working. some of that is growing pains for go modules. I get that, and assume things will improve. this particular issue is about vendoring. and the original problem is still outstanding which is that the replace directive just doesn't function properly. yes its been discussed but it hasn't been fixed. there are real world problems that ignoring it in the tools causes problems; particularly around distribution and maintenance of a tool. my latest suggestions could potentially be a path forward to fixing said issue. but it certainly will never be fixed unless the source repository is considered. the module path simply isn't sufficient. I've literally linked to a repository that no longer builds correctly as a result of these changes correct despite having vendored dependencies. even worse is iirc it says it builds correctly, but it builds with the I'm not sure what else you'd like me to do. I've given a real world example, the problem itself (along with others generally), and possible ideas to address it. |
Sorry, but “doesn't function properly” is not actionable. We need to be able to see the same symptoms you're seeing in order to understand what's going wrong for you. The issue template asks “What did you do?”, “What did you expect to see?”, and “What did you see instead?”. Those questions need specific answers. You say that you've given a real example that no longer builds, but all I see in support of that for this specific issue is a link to a repository. At what commit did you have the repository checked out? What commands did you use it before, and with what environment variables? What Probably to make progress it would be best to start by filing a new issue and filling out the issue template. The original post for this issue lists too many disparate complaints to be actionable as a single issue, and I'm having a hard time following which parts you believe are still unaddressed. |
sorry given the nature of the conversation up until now it was understood how and why the replace directive didn't function. through the various iterations of the conversation. I'll happily recreate the issue focusing specifically on that aspect at some point in the future when I have time. but the particularly deficiency has been discussed repeatedly and its always ended the same with the golang team basically denying there is a real world problem with their choices. but i'll happily try again later once i have time to hand hold the issue. |
I am not asking you to recreate an issue that was previously closed for a design point that was already settled. I am asking to to create a new issue if you have new information about something that isn't working as designed, or an aspect or implication of the design that was not known at the time the design was settled. |
Closing as there is no actionable information here. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
this is more of an experience report vs a specific bug/proposal around things I've found frustrating with go tooling since moving to modules for the last year.
vendor setups are treated as second class citizens.
this shows itself in a number of ways.
go get
doesn't automatically install to the vendor directory. requiring an additional command.go get updates dependencies without explicit user action.
I've run into this a number of types where I'm working run so go tooling commands and when I build/run into an error where my vendor is out of sync with go.mod only to find a bunch of modules have been updated. Unfortunately I don't know exact which command is causing this, I suspect go get or go mod tidy but its just a gut feeling based on what I remember doing each time i've run into this. what I do know is this has occurred to me multiple times now where dependencies I was not interacting with in any way have been updated.
possibly related:
go modules has caused an explosion in complexity in the go environment
it has almost doubled the number of environment variable flags. its responsible for 9 out of 20 environment variables.
most of which are accessing the network and all of which could essentially be dropped from a developers consciousness with a functional vendor directory. in fact if a vendor directory is detected in the main module during get/install/build you could in fact treat it as the gomodcache unless upgrading or adding a new package (in which case you're interacting with the VCS to populate that cache).
The text was updated successfully, but these errors were encountered: