this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cmd/cue: remove CUE_VERSION_OVERRIDE from testscripts

As described in https://cuelang.org/cl/1195718,
`cue mod tidy` no longer adds or modifies `language.version` in any way,
so the use of CUE_VERSION_OVERRIDE in its tests was pointless now.

The only other use was in a `cue mod init` test that double checked
that the language.version inserted by init was decoupled from CUE's
module version by setting the module version to an empty pseudo-version.
However, this is unnecessary as CUE's own module version is almost never
exactly equal to the current language version, as it would only be the
case when one tests exactly a stable version such as

go test cuelang.org/go@v0.9.0

In practice, we continuously test master and pre-releases,
where the two versions will never be the same.
Keeping CUE_VERSION_OVERRIDE just for that edge case seems unnecessary.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I47161a3abcc476606b6dfe91177cdf541dd73303
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1195781
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Paul Jolly <paul@myitcv.io>

+8 -18
+3 -2
cmd/cue/cmd/testdata/script/modinit_without_version.txtar
··· 1 - # Check that cue mod init is independent of the module version. 2 - env CUE_VERSION_OVERRIDE=v0.0.0-00010101000000-000000000000 1 + # Check that cue mod init is independent of the module version; 2 + # even though CUE's current module version will often be a v0 pseudo-version 3 + # or a pre-release, we will always use the current language version in init. 3 4 env-fill want-module 4 5 exec cue mod init foo.example 5 6 cmp cue.mod/module.cue want-module
-1
cmd/cue/cmd/testdata/script/modtidy_initial.txtar
··· 3 3 # dependencies, and that it removes dependencies that 4 4 # aren't needed any more. 5 5 6 - env CUE_VERSION_OVERRIDE=v0.8.100 7 6 exec cue mod tidy 8 7 cmp cue.mod/module.cue want-module 9 8
-1
cmd/cue/cmd/testdata/script/modtidy_non_root.txtar
··· 2 2 # run in the module's root directory. 3 3 4 4 cd x/y 5 - env CUE_VERSION_OVERRIDE=v0.8.100 6 5 exec cue mod tidy 7 6 cd $WORK 8 7 cmp cue.mod/module.cue want-module
-2
cmd/cue/cmd/testdata/script/modtidy_with_existing_version.txtar
··· 1 1 # Check that cue mod tidy won't change the language 2 2 # version when the field is already present in the module.cue file. 3 3 4 - env CUE_VERSION_OVERRIDE=v0.8.300 5 4 exec cue mod tidy 6 5 cmp cue.mod/module.cue want-module 7 - 8 6 9 7 # Check that the resulting module evaluates as expected. 10 8 exec cue export .
-1
cmd/cue/cmd/testdata/script/modtidy_with_generated_code.txtar
··· 3 3 # dependencies, and that it removes dependencies that 4 4 # aren't needed any more. 5 5 6 - env CUE_VERSION_OVERRIDE=v0.8.100 7 6 exec cue mod tidy 8 7 cmp cue.mod/module.cue want-module 9 8
-1
cmd/cue/cmd/testdata/script/modtidy_with_version.txtar
··· 1 1 # Check that cue mod tidy fails when there is no version 2 2 # present in the module.cue file. 3 3 4 - env CUE_VERSION_OVERRIDE=v0.8.100 5 4 ! exec cue mod tidy 6 5 cmp stderr want-stderr 7 6
+5 -10
cmd/cue/cmd/version.go
··· 52 52 // shouldn't happen 53 53 return errors.New("unknown error reading build-info") 54 54 } 55 - fmt.Fprintf(w, "cue version %s\n\n", moduleVersion()) 55 + fmt.Fprintf(w, "cue version %s\n\n", cueModuleVersion()) 56 56 fmt.Fprintf(w, "go version %s\n", runtime.Version()) 57 57 bi.Settings = append(bi.Settings, debug.BuildSetting{ 58 58 Key: "cue.lang.version", ··· 75 75 return nil 76 76 } 77 77 78 - // moduleVersion returns the version of the main module as much 79 - // as can reasonably be determined. If no version can be 80 - // determined, it returns the empty string. 81 - func moduleVersion() string { 82 - if testing.Testing() { 83 - if v := os.Getenv("CUE_VERSION_OVERRIDE"); v != "" { 84 - return v 85 - } 86 - } 78 + // cueModuleVersion returns the version of the cuelang.org/go module as much 79 + // as can reasonably be determined. If no version can be determined, 80 + // it returns the empty string. 81 + func cueModuleVersion() string { 87 82 if v := version; v != "" { 88 83 // The global version variable has been configured via ldflags. 89 84 return v