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
cmd/cue: the current release/language version should be known for local builds #2908
Comments
Recently, @rogpeppe and I discussed adding a manual version string to the Now that
Teaching |
Sounds like a good approach to me. Thanks for the analysis. |
As described in https://cuelang.org/issue/2908, the behavior now is: 1) Users explicity setting a version at build time via -ldflags='-X cuelang.org/go/cmd/cue/cmd.version=<version>' would use that version as-is, just like today 2) Users building via GOPROXY would get the module version reported by the proxy as-is, just like today 3) Other users (i.e. those using `go install ./cmd/cue`) would now get the fallback version added by this patch and updated manually, even if they are currently a few commits after that last tag, since `cue version` will still print the stamped VCS information That is, up until now and in master, we had $ go install ./cmd/cue $ cue version cue version v0.0.0-20240307083748-cdcb6fa19bf3 go version devel go1.23-58052fe8e7 2024-03-07 05:27:04 +0000 -buildmode exe -compiler gc DefaultGODEBUG httplaxcontentlength=1,httpmuxgo121=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1,winreadlinkvolume=0,winsymlink=0 CGO_ENABLED 1 GOARCH amd64 GOOS linux GOAMD64 v3 vcs git vcs.revision cdcb6fa vcs.time 2024-03-07T08:37:48Z vcs.modified false Whereas now, we have $ go install ./cmd/cue $ cue version cue version v0.8.0-alpha.5 go version devel go1.23-58052fe8e7 2024-03-07 05:27:04 +0000 -buildmode exe -compiler gc DefaultGODEBUG httplaxcontentlength=1,httpmuxgo121=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1,winreadlinkvolume=0,winsymlink=0 CGO_ENABLED 1 GOARCH amd64 GOOS linux GOAMD64 v3 vcs git vcs.revision 9d9b786f0996468bf527a9412d1389a7a17a0562 vcs.time 2024-03-07T15:13:21Z vcs.modified false Such a local build will also now be able to add language.version to cue.mod/module.cue via `cue mod init` and `cue mod tidy`, as up until now a local cmd/cue build did not know its own semver version, from which we derive the language version. Add a TODO to this added fallback version, as once upstream Go implements the proposal at https://go.dev/issue/50603, we can remove this manually updated version and keep semver versions in local builds via the Go toolchain automatically. Fixes #2908. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: I9e6189fcdaff5b493c9065e5bb74f4dd9a023800
As described in https://cuelang.org/issue/2908, the behavior now is: 1) Users explicity setting a version at build time via -ldflags='-X cuelang.org/go/cmd/cue/cmd.version=<version>' would use that version as-is, just like today 2) Users building via GOPROXY would get the module version reported by the proxy as-is, just like today 3) Other users (i.e. those using `go install ./cmd/cue`) would now get the fallback version added by this patch and updated manually, even if they are currently a few commits after that last tag, since `cue version` will still print the stamped VCS information That is, up until now and in master, we had $ go install ./cmd/cue $ cue version cue version v0.0.0-20240307083748-cdcb6fa19bf3 go version devel go1.23-58052fe8e7 2024-03-07 05:27:04 +0000 -buildmode exe -compiler gc DefaultGODEBUG httplaxcontentlength=1,httpmuxgo121=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1,winreadlinkvolume=0,winsymlink=0 CGO_ENABLED 1 GOARCH amd64 GOOS linux GOAMD64 v3 vcs git vcs.revision cdcb6fa vcs.time 2024-03-07T08:37:48Z vcs.modified false Whereas now, we have $ go install ./cmd/cue $ cue version cue version v0.8.0-alpha.5 go version devel go1.23-58052fe8e7 2024-03-07 05:27:04 +0000 -buildmode exe -compiler gc DefaultGODEBUG httplaxcontentlength=1,httpmuxgo121=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1,winreadlinkvolume=0,winsymlink=0 CGO_ENABLED 1 GOARCH amd64 GOOS linux GOAMD64 v3 vcs git vcs.revision 9d9b786f0996468bf527a9412d1389a7a17a0562 vcs.time 2024-03-07T15:13:21Z vcs.modified false Such a local build will also now be able to add language.version to cue.mod/module.cue via `cue mod init` and `cue mod tidy`, as up until now a local cmd/cue build did not know its own semver version, from which we derive the language version. Add a TODO to this added fallback version, as once upstream Go implements the proposal at https://go.dev/issue/50603, we can remove this manually updated version and keep semver versions in local builds via the Go toolchain automatically. Update all existing test files as well. Fixes #2908. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: I9e6189fcdaff5b493c9065e5bb74f4dd9a023800
Until the accepted proposal at golang/go#50603 is implemented, this is the situation:
That is, a local build has VCS information, but it doesn't know what semver version it is or it follows, in this case https://github.com/cue-lang/cue/releases/tag/v0.8.0-alpha.4.
This affects
cue mod init
andcue mod tidy
in that not knowing the semver tag means we don't insertlanguage.version
: #2811 (comment)This is a tracking issue; we can't do much until upstream implements the accepted proposal, so I expect this issue will remain open for at least a few months. Still, it's useful to track as a dependency for other issues or sharp UX edges.
The text was updated successfully, but these errors were encountered: