-
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: implement cue mod tidy --check
This wires up `modload.CheckTidy` to the cue command. Specifically, `cue mod tidy --check` succeeds only if the module file is contains exactly the required dependencies and also contains a CUE language version. Fixes #2910. Signed-off-by: Roger Peppe <rogpeppe@gmail.com> Change-Id: I49379d28d7ab156016cfeb21bd26834e42dd2df1 Dispatch-Trailer: {"type":"trybot","CL":1178021,"patchset":2,"ref":"refs/changes/21/1178021/2","targetBranch":"master"}
- Loading branch information
Showing
5 changed files
with
59 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Check that cue mod tidy --check succeeds OK | ||
# even when the module file is formatted differently | ||
# e.g. language.version in a single line. | ||
|
||
exec cue mod tidy --check | ||
|
||
-- cue.mod/module.cue -- | ||
module: "main.org@v0" | ||
language: version: "v0.99.99" | ||
|
||
// A comment. | ||
deps: "example.com@v0": v: "v0.0.1" | ||
|
||
-- main.cue -- | ||
package main | ||
import "example.com@v0:main" | ||
|
||
main | ||
|
||
-- _registry/example.com_v0.0.1/cue.mod/module.cue -- | ||
module: "example.com@v0" | ||
|
||
-- _registry/example.com_v0.0.1/top.cue -- | ||
package main | ||
|
||
"example.com@v0": "v0.0.1" |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Check that cue mod tidy --check fails when some dependencies aren't present. | ||
|
||
! exec cue mod tidy --check | ||
cmp stderr want-stderr | ||
|
||
-- want-stderr -- | ||
module is not tidy: cannot find module providing package example.com@v0:main | ||
-- cue.mod/module.cue -- | ||
module: "main.org@v0" | ||
language: version: "v0.99.99" | ||
|
||
-- main.cue -- | ||
package main | ||
import "example.com@v0:main" | ||
|
||
main | ||
|
||
-- _registry/example.com_v0.0.1/cue.mod/module.cue -- | ||
module: "example.com@v0" | ||
|
||
-- _registry/example.com_v0.0.1/top.cue -- | ||
package main | ||
|
||
"example.com@v0": "v0.0.1" | ||
|
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