-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/cue: hard-code a fallback CUE semver version
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
- Loading branch information
Showing
11 changed files
with
45 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,6 @@ exists cue.mod/pkg | |
|
||
-- want-module.cue -- | ||
module: "foo.com/bar@v1" | ||
language: { | ||
version: "v0.8.0-alpha.5" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,6 @@ exists cue.mod/pkg | |
|
||
-- want-module.cue -- | ||
module: "" | ||
language: { | ||
version: "v0.8.0-alpha.5" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,6 @@ exists cue.mod/pkg | |
|
||
-- want-module.cue -- | ||
module: "foo.com/bar@v0" | ||
language: { | ||
version: "v0.8.0-alpha.5" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
module: "" | ||
language: { | ||
version: "v0.8.0-alpha.5" | ||
} |