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: add 'go mod vendor -o <dir>' #47327

Closed
rsc opened this issue Jul 21, 2021 · 5 comments
Closed

cmd/go: add 'go mod vendor -o <dir>' #47327

rsc opened this issue Jul 21, 2021 · 5 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Jul 21, 2021

Thinking about how to get a copy of all the code that is needed for a given build, for uploading to some kind of a remote build (Google App Engine or other similar systems).

Right now if you upload just the main module, then the remote build has to resolve all the dependencies. But what if the dependencies are private modules, and the remote build has no access to them? This happens.

The solution I have used in the past is to run go mod vendor and then do the upload of the main module. That works, but then you have a vendor directory you need to remove (assuming you don't want it in you repo).

What could be done instead is to have the uploader itself run go mod vendor, zip up the main module, and then delete the vendor directory. That's almost perfect except that I think it's bad form for an uploader to be making changes in the actual directory being uploaded.

If instead go mod vendor took a -o flag saying what directory to write the vendor tree to, then the uploader could write it to a temporary place and then combine that with the contents of the actual main module directory.

We should do this for Go 1.17 Go 1.18.

In the long term, we might also consider some kind of formal "archive of everything for a build", so that you could go mod archive -o x.zip, but there's a lot to figure out there about exactly what that zip file looks like, how you build it, and so on.

For now if we do go mod vendor -o, then that will unblock uploaders.

@rsc rsc added this to the Go1.17 milestone Jul 21, 2021
@rsc rsc added the NeedsFix The path to resolution is known, but the work has not been done. label Jul 21, 2021
@tpaschalis
Copy link
Contributor

I can take a stab if there's no one already on it. From a quick look, it looks straightforward; adding the new option, and working with a different vdir.

@rsc
Copy link
Contributor Author

rsc commented Jul 26, 2021

I think I confused myself about which was the next release and meant Go 1.18 for this.

@rsc rsc modified the milestones: Go1.17, Go1.18 Jul 26, 2021
@gopherbot
Copy link

Change https://golang.org/cl/338149 mentions this issue: cmd/go: add 'go mod vendor -o' flag

@gopherbot
Copy link

Change https://golang.org/cl/362814 mentions this issue: _content/ref/mod: document '-o' flag for go mod vendor

gopherbot pushed a commit to golang/website that referenced this issue Nov 10, 2021
For golang/go#47327

Change-Id: I8f6a4da541be4d95aa8b420b0294a0c1e78b8a0b
Reviewed-on: https://go-review.googlesource.com/c/website/+/362814
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Than McIntosh <thanm@google.com>
@gopherbot
Copy link

Change https://golang.org/cl/363174 mentions this issue: doc/go1.18: add a release note for 'go mod vendor -o'

gopherbot pushed a commit that referenced this issue Nov 11, 2021
For #47327

Change-Id: I50418c0d017c4e90a2c13d26945ee639079e4e33
Reviewed-on: https://go-review.googlesource.com/c/go/+/363174
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Paschalis Tsilias <paschalistsilias@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
passionSeven added a commit to passionSeven/website that referenced this issue Oct 18, 2022
For golang/go#47327

Change-Id: I8f6a4da541be4d95aa8b420b0294a0c1e78b8a0b
Reviewed-on: https://go-review.googlesource.com/c/website/+/362814
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Than McIntosh <thanm@google.com>
@golang golang locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants