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

proposal: mod: allow specifying "latest" in a way that considers pre-releases too #3799

Open
rogpeppe opened this issue Mar 7, 2025 · 2 comments
Labels
FeatureRequest New feature or request modules Issues related to CUE modules and the experimental implementation Proposal

Comments

@rogpeppe
Copy link
Member

rogpeppe commented Mar 7, 2025

Currently cue mod get supports @latest, which means "latest stable version, unless no stable
versions are available, in which case latest unstable version".

Sometimes it's desirable to update to the latest version even if it's a pre-release version
and there are existing stable versions.

We could support @tip for this use case.

For example, for some module M, currently if the following versions of M are in the registry:

v1.0.0
v1.2.3
v1.2.4-alpha1
v1.2.4-alpha2

then M@latest will resolve to v1.2.3 because it will never choose a pre-release over a stable release.

This proposal is to allow M@tip to specify the latest version regardless of whether it's stable or not, so M@tip would resolve to v1.2.4-alpha2 in this case.

@rogpeppe rogpeppe added FeatureRequest New feature or request Proposal modules Issues related to CUE modules and the experimental implementation labels Mar 7, 2025
@myitcv
Copy link
Member

myitcv commented Mar 8, 2025

cc @mvdan - we've discussed this before from memory, in the context of golang/go#42545

Edit: apologies, I've now seen the Slack thread that gave rise to this.

@myitcv
Copy link
Member

myitcv commented Mar 8, 2025

Just one point on terminology here. I don't think you mean to use the term "stable". I think you mean to distinguish between pre-release version and release version (I realise the latter does not have a precise name in the semver.org spec). "Stable" implies, according to the semver spec, a major version >=1. That does not necessarily apply to the query you are looking to specify. Because it's possible distinguish between a pre-release version and release version of a v0 version: e.g. v0.1.0-alpha.1 and v0.1.0.

I'm also not clear that tip is the best name. It implies a VCS, specifically the commit at the tip of the default branch. But that is not necessarily what the latest pre-release version is (indeed given the registry setup it almost certainly isn't unless someone is pushing pre-release pseudo-versions for every commit).

One further question, @rogpeppe. What should these queries look like when the major version number is involved? For example, if I wanted the latest pre-release of v2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest New feature or request modules Issues related to CUE modules and the experimental implementation Proposal
Projects
Status: Backlog
Development

No branches or pull requests

2 participants