-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cue/load: treat all absDirFromImportPath errors as PackageErrors
When `cue fmt` is formatting files, it explicitly checks for, and ignores, `load.PackageError`. If we fail to load a package in any way, we should ignore such a failure, so make all errors returned by `absDirFromImportPath` (the primary source of such errors), into a `PackageError`. Signed-off-by: Roger Peppe <rogpeppe@gmail.com> Change-Id: I3dafe2c7432342ebb96119b29d5b8796979a18d2 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1194851 TryBot-Result: CUEcueckoo <cueckoo@cuelang.org> Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
- Loading branch information
Showing
2 changed files
with
41 additions
and
14 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# This tests that when there's an import and no current module, | ||
# fmt will still work. | ||
|
||
stdin a/x.cue | ||
exec cue fmt - | ||
cmp stdout a.cue-want | ||
|
||
-- a/x.cue -- | ||
package x | ||
|
||
import "mod.com/p" | ||
|
||
x: p.p | ||
-- a.cue-want -- | ||
package x | ||
|
||
import "mod.com/p" | ||
|
||
x: p.p |
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