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

cue/load: support package pattern wildcards beyond the current module #3183

Open
mvdan opened this issue May 29, 2024 · 1 comment
Open

cue/load: support package pattern wildcards beyond the current module #3183

mvdan opened this issue May 29, 2024 · 1 comment
Labels
FeedbackWanted Further information is requested modules Issues related to CUE modules and the experimental implementation

Comments

@mvdan
Copy link
Member

mvdan commented May 29, 2024

To fix #3155, https://review.gerrithub.io/c/cue-lang/cue/+/1195195 takes an approach where package patterns with wildcards like ./... are only supported if they use the current module as a prefix, i.e. they aren't meant to match any external modules such as existing or missing dependencies. This is the simplest kind of wildcard to support, as it's very similar to filesystem globbing like **/, given that all possible matches are in the local current module.

Supporting arbitrary patterns with wildcards to query packages or modules may be problematic for a number of reasons:

  • They could take a long time; shoud .../foo match all "foo" packages across all CUE modules ever published?
  • They could require many requests to registries, particularly when trying to discover which modules may exist or contain a package.
  • They could be more complex algorithms; a wildcard matching an unknown number of modules might need to keep updating the module graph due to MVS.

This issue is mainly to capture what kinds of use cases people might have for package (or module) patterns beyond the current or local module.

@mvdan mvdan added FeedbackWanted Further information is requested modules Issues related to CUE modules and the experimental implementation labels May 29, 2024
@rogpeppe
Copy link
Member

  • They could take a long time; shoud .../foo match all "foo" packages across all CUE modules ever published?
  • They could require many requests to registries, particularly when trying to discover which modules may exist or contain a package.
  • They could be more complex algorithms; a wildcard matching an unknown number of modules might need to keep updating the module graph due to MVS.

Note that in practice Go does not support patterns of that form, as it almost always fails
because of missing go.sum entries.

For example, in the CUE project itself:

% go list .../qt
pattern .../qt: cloud.google.com/go/compute/metadata@v0.3.0: missing go.sum entry
% go list ...
go: updates to go.mod needed; to update it:
	go mod tidy

So I think it would probably be reasonable to restrict pattern matching outside the
current module to patterns that begin with a non-wildcard prefix that corresponds
to a module name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeedbackWanted Further information is requested modules Issues related to CUE modules and the experimental implementation
Projects
Status: Backlog
Development

No branches or pull requests

2 participants