-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/cue: allow cue mod tidy in non-module root
The module-root-finding code somewhat duplicates similar code in both `internal/mod/modpkgload` and `cue/load` but the former isn't suitable because it's defined in terms of `io/fs.FS` and reusing the latter would require adding new public API. Also avoid writing the module file when there's no change. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I2fb76abedc43f6be41e8eb16762d5e400acfa77d Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1173826 Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
- Loading branch information
Showing
2 changed files
with
52 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Check that cue mod tidy works OK even when not | ||
# run in the module's root directory. | ||
|
||
cd x/y | ||
exec cue mod tidy | ||
cd $WORK | ||
cmp cue.mod/module.cue want-module | ||
|
||
-- want-module -- | ||
module: "main.org@v0" | ||
-- cue.mod/module.cue -- | ||
module: "main.org@v0" | ||
-- x/y/z.cue -- | ||
package y | ||
-- _registry/example.com_v0.0.1/cue.mod/module.cue -- | ||
// This file is just here to ensure that CUE_REGISTRY etc is set. | ||
module: "example.com@v0" |