Skip to content

Update cuelang.org/go to v0.9.1#401

Merged
stefanprodan merged 1 commit into
stefanprodan:mainfrom
myitcvforks:cue_v0.9.1
Jun 28, 2024
Merged

Update cuelang.org/go to v0.9.1#401
stefanprodan merged 1 commit into
stefanprodan:mainfrom
myitcvforks:cue_v0.9.1

Conversation

@myitcv

@myitcv myitcv commented Jun 12, 2024

Copy link
Copy Markdown
Contributor

This PR only exists to verify a change that will be released as part of cuelang.org/go@v0.9.1. Specifically, it enables a compatibility mode where legacy modules (which do not have a language.version field) can be consumed.

For more information see https://cuelang.org/issue/3219

@stefanprodan

Copy link
Copy Markdown
Owner

@myitcv this looks great! Big thanks for the fix.

@myitcv

myitcv commented Jun 12, 2024

Copy link
Copy Markdown
Contributor Author

Great, thanks. Just to re-emphasise: please DON'T submit this PR. We'll tag v0.9.1 tomorrow (assuming we don't run into any other issues that need fixing). At which point we can re-do the PR to use the actual v0.9.1 release.

@errordeveloper

Copy link
Copy Markdown
Contributor

@stefanprodan do you think new modules should start adding 'language: version: v0.9.1' as well?

@stefanprodan

Copy link
Copy Markdown
Owner

@errordeveloper yes the blueprints used by timoni mod init will have the language version after next release.

@myitcv

myitcv commented Jun 13, 2024

Copy link
Copy Markdown
Contributor Author

'language: version: v0.9.1' as well?

Let me come back to you to confirm whether you should set language: version: "v0.9.0" or language: version: "v0.9.1" (assuming that is you upgrade to v0.9.1 when it is released).

@stefanprodan

Copy link
Copy Markdown
Owner

@myitcv I guess the version in module.cue is like for Go, and sets the minimum version supported? For example, a module with language: version: "v0.9.0" will work with CUE v0.10.0?

@myitcv

myitcv commented Jun 13, 2024

Copy link
Copy Markdown
Contributor Author

@myitcv I guess the version in module.cue is like for Go, and sets the minimum version supported? For example, a module with language: version: "v0.9.0" will work with CUE v0.10.0?

Correct, I just wanted to double check our plan with respect what cue mod init will do when we release v0.9.1 (because that's effectively the command that you are emulating in Timoni).

To confirm, in CUE v0.9.1, cue mod init will include the following line:

language: version: "v0.9.0"

So Timoni should do the same. Please feel free to mark this hard-coding as a "TODO" on your side, because we are also going to expose the following via public API:

https://github.com/cue-lang/cue/blob/859f1f6daadaaf200ab10702f93af03fd97329b8/internal/cueversion/version.go#L20

At which point you can remove the hard-coding.

In so doing, set cue/load.Config.AcceptLegacyModules when loading
modules, to allow pre-existing Timoni modules (which don't have a
language.version field) to be loaded. For more information see
https://cuelang.org/issue/3219

Note that https://cuelang.org/issue/3222 tracks making a change in a
later CUE release that will "fix" the language.version implied by
AcceptLegacyModules. This is not significant right now, because there
are not yet any language changes guarded by language.version, but it
will become significant when such changes are introduced.
@stefanprodan stefanprodan changed the title Prepare for cuelang.org/go v0.9.1 Update cuelang.org/go v0.9.1 Jun 14, 2024

@stefanprodan stefanprodan left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks @myitcv 🥇

@stefanprodan stefanprodan added the dependencies Pull requests that update a dependency file label Jun 14, 2024
@stefanprodan stefanprodan changed the title Update cuelang.org/go v0.9.1 Update cuelang.org/go to v0.9.1 Jun 14, 2024
@stefanprodan stefanprodan merged commit 9e4e50c into stefanprodan:main Jun 28, 2024
@myitcv myitcv deleted the cue_v0.9.1 branch June 28, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants