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

Open
rsc opened this issue Jul 21, 2021 · 3 comments
Open

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

rsc opened this issue Jul 21, 2021 · 3 comments
Labels
Milestone

Comments

@rsc
Copy link
Contributor

@rsc 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 label Jul 21, 2021
@tpaschalis
Copy link
Contributor

@tpaschalis tpaschalis commented Jul 26, 2021

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 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 removed this from the Go1.17 milestone Jul 26, 2021
@rsc rsc added this to the Go1.18 milestone Jul 26, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 28, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants