Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mod/modconfig: factor out from cmd/cue
This factors out functionality that's currently only available inside cmd/cue so that users can use the standard CUE module resolution logic from the Go API. Some packages are not (yet) exposed in the public API, notably `modpkgload` and `modload`, which is where the registry interface type used by `cue/load` is currently defined. Rather than use a type alias to an internal type, which would make for awkward documentation, we define the interface type independently inside `cue/load` and statically ensure that it's compatible in both directions. The `SourceLoc` type is also defined in a package that will not yet be made public, so move it into `mod/module` which seems not unreasonable, as it's explicitly to do with module source code locations. Also move the other related APIs, such as `OSRootFS`, because they seem closely related. Also, the `CUEModSummary` type doesn't really fit anywhere very happily, but it's unnecessary at that level, so rename the `CUEModSummary` method to `Requirements`, making it redundant. The new `mod/modconfig` package needs access to CUE configuration in the standard place, but we don't wish to expose all the details of that for now, and it's not desirable to duplicate that logic inside `cmd/cue`, so we create an `internal/cueconfig` package accessible to both `mod/modconfig` and `cmd/cue` but not to external users. For #2874. Signed-off-by: Roger Peppe <rogpeppe@gmail.com> Change-Id: I8493dc3820ab4f98f8ebeaff08731ad1b39bde08 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1177415 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com> TryBot-Result: CUEcueckoo <cueckoo@gmail.com>
- Loading branch information
Showing
29 changed files
with
821 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.