cmd/go: consider some type of tooling to easily test multiple major versions in a single binary #27514
Labels
FrozenDueToAge
modules
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Go 1.11
Brief background
Semantic import versioning means multiple major versions of a package might be included in a single build (e.g., v1 and v2 might both be in a single build, or perhaps something like v1, v7, and v15 in a single build). This approach helps with multiple aspects of the modules system, including helping with diamond dependency problems, or allowing a major version to be implemented as a shim around a different major version, etc.
Some related snippets from the "Avoiding Singleton Problems" section of the https://research.swtch.com/vgo-import post, which outlines how this is an improvement over multiple copies due to vendoring and sketches some possible approaches to avoiding conflicts across major versions of a module:
Suggestion
This is not fully fleshed out idea, but recording here in case it triggers others in the community to comment with more precise thoughts.
Ideally the go tooling would make it easy to test multi-major version scenarios to help catch any related problems with global registries, global handlers, singletons, etc.
Consider some type of testing option that automatically creates a single binary containing all major versions of a module and runs their tests in parallel from within a single binary. This would not catch all issues, but might help catch the most common issues that arise from having more than one major version in a single build.
Perhaps this could be a
go test
feature, or part ofgo release
(#26420), or ____. Perhaps this could be for all major versions, as well as perhaps for a subset of major versions (e.g., perhaps a set of manually selected major versions, or perhaps the tooling could automatically selecting different subsets of major versions).Ideally it could done in a way such that it is very easy for a module author.
Alternatively, perhaps this is just a documented recommendation with the steps needed to do this manually.
@gopherbot, please add label modules.
The text was updated successfully, but these errors were encountered: