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: [modules + integration] tidy a specific module descriptor #31318

Open
nim-nim opened this issue Apr 7, 2019 · 0 comments
Open

cmd/go: [modules + integration] tidy a specific module descriptor #31318

nim-nim opened this issue Apr 7, 2019 · 0 comments
Labels
modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@nim-nim
Copy link

nim-nim commented Apr 7, 2019

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 mod tidy needs to optionally operate on a specific *.mod module descriptor file.

Constrains

  • the command needs to operate both on:
    • unpacked module trees (with go.mod located at the tree root) and
    • packed modules (with the module descriptor filename matching the zip payload filename)
  • the module descriptor filesystem path should be specifiable explicitly
    • all the levels of caching and abstraction in the Go module design, make matching by module path (+ module version) tricky for humans. It is very likely the go command will find some other module in its cache to work on, instead of using the one the human intended.
    • implicit descriptor matching like is the case right now does not work for packed modules
      • several versions of the same module can be deployed in the same directory in packed mode, as specified in goproxy
  • the feature should also be exposed as a function in the official Go API
  • the command should work in secure no-internet-download mode. In that mode it should probably restricts its processing to direct dependencies and the dependencies available in configured goproxy sources (cmd/go: [modules + integration] use several goproxy sources simultaneously #31304)

Motivation

Curating a module for use in an integration baseline may result in:

  • culling dead or unnecessary module code, or
  • patch it it to use different imports, targeting a new API version or a different fork of the same original project

This will invalidate part of the dependency information in the upstream go.mod file. In fact, retargetting dependencies to something saner, part of the integrator baseline, is often the whole point of the curating process.

It is undesirable to recompute the new module descriptor before all the curating operations in the CI/CD job have finished. As long as the module has not been packed, some modifications can still occur. Therefore, the correct and safe go mod tidy target is the packed module fileset.

Trying to schedule descriptor tiding before the packing has finished is unreliable, because some of the culling can occur directly during zip payload writing time. That is not the case for go mod pack, as specified in #31302, but it is the case for modist.

@julieqiu julieqiu added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 22, 2019
@julieqiu julieqiu added this to the Go1.13 milestone Apr 22, 2019
@rsc rsc changed the title cmd/go: [modules + integration] go mod tidy a specific module descriptor cmd/go: [modules + integration] tidy a specific module descriptor Apr 30, 2019
@andybons andybons modified the milestones: Go1.13, Go1.14 Jul 8, 2019
@rsc rsc modified the milestones: Go1.14, Backlog Oct 9, 2019
@ALTree ALTree added the modules label Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants