-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: [modules + integration] go mod buildrequires, list the build requirements of a set of unpacked modules #31300
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
In general, you are asking for a whole bunch of low-level tools that depend on specific details of today's implementation. We do not want to expose any of those, because they may well not apply to tomorrow's implementation. We should have a discussion about what Linux distributions should do as far as modules are concerned. Posting a sequence of issues asking for specific low-level commands assumes a specific solution to that general problem and puts the cart before the horse. |
@rsc The intent is precisely to isolate Linux distributions from Go Modules low-level implementation details, to allow this implementation to evolve freely, without breaking distribution tools every release. The command set basically describes the CLI API we use to interface with language (python, perl, java, ruby, rust, js…) and non language (fontconfig, ctan, icon…) component systems. We, unfortunately, do not have a nice comprehensive interface design spec. Interfacing grew organically over time, as component systems gained new capabilities distribution and language side. And, it is relatively unusual to onboard a whole full-fledged component system like Go modules in a single step (most languages construct their component systems progressively). Also, I took the time to check each listed part was actually needed and compatible with the Go module design, and to translate rpm concepts to the Go module equivalent. But there's absolutely nothing in there specific to the current Go module implementation (nor specific to Go nor rpm in general). So unless Go starts doing very weird and unusual things this command set should be sufficient for its present and future needs. And if it starts doing radically different things, the command interface can always be extended (as long as those new things are compatible with distribution objectives and core design decisions). If the command set is fully implemented, we won't have to dig deep inside the Go Module code to implement custom replacements, and you can evolve this code at will without breaking Go integration distribution-side. If it's not fully implemented we’ll request the Go API parts needed to implement it ourselves. To illustrate, this recent example showcases how it all works out for a rust (to take something roughly similar to Go). The
lines in the middle are equivalent to the |
sounds like a won't do. |
This report is part of a series, filled at the request of @mdempsky, focused at making Go modules integrator-friendly.
Please do not close or mark it as duplicate before making sure you’ve read and understood the general context. A lot of work went into identifying problems points precisely.
Needed feature
Go needs an official
go mod buildrequires
command that processes a set of unpacked Go modules and returns the list of other Go modules that need to be present for this set to be processed by the rest of the go toolchain.This kind of analysis is required to populate build environments in CI/CD systems accurately, either to complete the set with other modules, or make sure it is self-hosting before a CI/CD run.
go mod buildrequires
could be implemented as ago mod graph
mode, via specific option flags, or as a separate subcommand.Constrains
require
,exclude
andreplace
of all thego.mod
files in the set,go.mod
individual requirementsgo.mod
filesystem paths (as produced bygo mod discover
in issue cmd/go: [modules + integration] go mod discover, discover a set of unpacked modules within a directory #31299), one or several directory paths (similar to the directory paths defined in issue cmd/go: [modules + integration] go mod discover, discover a set of unpacked modules within a directory #31299), or a mix of both¹ The experimental code is probably horrible. That's not the point. Most of its functions are generic and should have been provided by generic Go tooling in the first place.
Motivation
the Go modules design allows the splitting of projects in multiple modules and nested submodules. Therefore, the CI/CD integration unit for Go, is now a source state that may contain a variable number of coordinated Go modules. The go toolchain should not assume that the inputs/outputs of a CI/CD run are a single module declared in a single
go.mod
file.robust CI/CD systems will cut internet access during a run to ensure the reproducibility and security of run results. A CI/CD build environment needs to be populated with all the code the run needs, before the run starts. Later
go get
calls won’t work.populating a CI/CD build environment with more code, than the strict minimum the run will need, gets prohibitively expensive in run time, for busy build farms with a huge list of jobs to run. Therefore the build requirement list needs to be as cut down as possible, allowing to remove:
missing modules, identified by the
go mod buildrequires
call, will typically be populated from the organisation baseline. Because parts of this baseline can be shared between organisation projects, it won't be mirrored in each project VCS in a vendor directory.missing module population will make use of recent CI/CD improvements, driven by the needs of Rust, Go and Python ³
adding new modules to the organisation baseline is a lot of work². It requires
therefore, there was violent disbelief and rejection among consulted integrators⁴, of any Go module setup, that forced them to process new modules just because the corresponding imports exists in module parts they have no use for:
² Initial import represents the bulk of the work, keeping the module updated once imported is a lot more reasonable.
³
go mod buildrequires
to its maximum effectgo mod buildrequires
⁴ Sometimes, interrupting before the end of the presentation of Go module changes
The text was updated successfully, but these errors were encountered: