-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/cue: mod init should only add
@v0
with the experiment
Otherwise, existing users of `cue mod init` who haven't opted into CUE_EXPERIMENT=modules would get different and likely broken behavior. We add test cases with and without the experiment for both a module path argument with and without a major version, for clarity. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: I32afc0e669fd5bfd5634ec382111d2e2846dcd9e Dispatch-Trailer: {"type":"trybot","CL":1183394,"patchset":2,"ref":"refs/changes/94/1183394/2","targetBranch":"master"}
- Loading branch information
Showing
4 changed files
with
38 additions
and
2 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
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,11 +1,28 @@ | ||
env CUE_VERSION_OVERRIDE=v0.1.2 | ||
|
||
# Without the experiment, the major version is allowed, | ||
# even though it's not particularly useful. | ||
# It feels unnecessary to ask the user to re-run with the experiment. | ||
exec cue mod init foo.com/bar@v1 | ||
cmp cue.mod/module.cue want-module.cue | ||
exists cue.mod/usr | ||
exists cue.mod/pkg | ||
|
||
# With the experiment, it works as expected. | ||
env CUE_EXPERIMENT=modules | ||
rm cue.mod | ||
exec cue mod init foo.com/bar@v1 | ||
cmp cue.mod/module.cue want-module-experiment.cue | ||
exists cue.mod/usr | ||
exists cue.mod/pkg | ||
|
||
-- want-module.cue -- | ||
module: "foo.com/bar@v1" | ||
language: { | ||
version: "v0.1.2" | ||
} | ||
-- want-module-experiment.cue -- | ||
module: "foo.com/bar@v1" | ||
language: { | ||
version: "v0.1.2" | ||
} |
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