-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: embed: Allow remote resources to be embedded #56401
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 opens up a massive can of worms on remote resource access: protocol, proxies, authentication, caching, as well as all the issues of tar. |
I think that people understand that commands like |
You can use |
This is a valid concern and I would understand if a proposal is rejected due to the overall complexity of the implementation.
I believe (depending on your proxy configuration, vendoring and previous
This is a possible workaround if the download should occur in the module I am building directly. This will not work if a module I depend on wants to download + embed a file. |
Sounds like you could look into git-lfs then: #47308 Also note that you don't even need to use a VCS to publish a Go module. You can publish versions as zip files on an HTTP server: https://go.dev/ref/mod#serving-from-proxy Or, more simply, if we're talking about a Go module that you will just build locally without a need to Finally, note that there is currently a limit of about 500 MiB on module sizes, both when compressed as a zip and when uncompressed. I would argue that embedding more than a few tens of megabytes of files is already a bad idea in general, but you'd also run into this limit pretty easily with large files. |
This contradicts most of the design goals for modules. We really really want reproducible, self-contained builds that don't change from day to day. The hash helps, but the build can still fail today when it worked yesterday. |
This proposal has been added to the active column of the proposals project |
This proposal has been declined as infeasible. |
Currently, go embed only allows for local files to be embedded in the final binary. While I understand that this beneficial for security, reproducibility and running
go build
in airgapped environments, it also has a major drawback:Every file embedded into the go binary has to either be checked in with your VCS or be downloaded dynamically before using
go build
(and other go commands).Checking every file into your VCS is not feasible for binary blobs of certain sizes as file sizes are often limited and binary blobs are prone to creating huge diffs.
Adding extra required steps before running
go build
is problematic as well. I like the fact that I don't need special Makefiles and build tools to use go.My proposal is as follows:
This has the following advantages:
The text was updated successfully, but these errors were encountered: