-
Notifications
You must be signed in to change notification settings - Fork 312
cmd/cue: support $pkg@$version specification of packages #3618
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
Labels
FeatureRequest
New feature or request
Comments
cueckoo
pushed a commit
that referenced
this issue
Mar 21, 2025
To support package paths like `foo.com/[email protected]` and `@latest`, we'll need to recognize those paths as packages, so change filetypes.IsPackage to do so. For #3618. Signed-off-by: Roger Peppe <[email protected]> Change-Id: If48f8821ca48680d146b9ffd778a529d19af4483 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1211883 Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
cueckoo
pushed a commit
that referenced
this issue
Mar 21, 2025
This adds a method to the registry cache to enable fetching from the cache directly without falling back to registry access. This will be used as the fast path for looking up modules by their absolute version without the need to check all path prefixes in the registry. We want the `modload` package to be able to depend on this logic, so avoid the need for modcache to depend on modload by exporting the concrete type instead of the interface type. Also define an interface type for the new cache method so we can potentially have different kinds of cache implementations in the future. Also document the error return of the `Fetch` and the new `FetchFromCache` methods so that we can distinguish between "module not present" and other errors. For #3618. Signed-off-by: Roger Peppe <[email protected]> Change-Id: Idf713910ccb7f09b0c43c125281171dfb5638866 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1211884 Reviewed-by: Daniel Martí <[email protected]> Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
cueckoo
pushed a commit
that referenced
this issue
Mar 21, 2025
These tests ensure that we can use ParseImportPath to parse the new query syntax. No logic changes were necessary, but it's good to be explicit that this works. For #3618. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I89e170006bb9ad5d2597294dfd65d4ccecd97ce4 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1211885 Reviewed-by: Daniel Martí <[email protected]> Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
cueckoo
pushed a commit
that referenced
this issue
Mar 21, 2025
This factors out some of the logic that was previously internal to Packages.importFromModules into a place where it can be reused to find a module for an absolute import path. Also define a `PackageLoc` type to make it more convenient to return a slice of package locations. While we're about here, remove the unused `altMods` field. For #3618. Signed-off-by: Roger Peppe <[email protected]> Change-Id: Ia15d6447a75a6f979a02edb313da57d1fedb0962 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1211886 Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
cueckoo
pushed a commit
that referenced
this issue
Mar 21, 2025
This allows us to look up the module for a package that's specified in absolute terms, independently of a main module. For #3618. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I004f1b3f3af16d31b252869462471416f3647a74 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1211887 Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of CUE are you using (
cue version
)?Is your feature request related to a problem? Please describe.
It is proving to be common to want to refer to a package in version of a published CUE module but not be module context when doing so. This is possible in Go, for example:
This command can be run anywhere, and requires/uses zero context from the working directory: it only relies on the configuration described by
go env
.Having something similar in CUE would allow:
cue vet $pkg@$version -d '#schema' data.yaml
cue export $pkg@$version -e part.of.config
Describe the solution you'd like
The ability to run
cue/cmd
commands with a package specification of$pkg@$version
, where$pkg
is a fully qualified package path, and$version
is a semver version or a version query like@latest
.Describe alternatives you've considered
The alternative requires:
Additional context
n/a
The text was updated successfully, but these errors were encountered: