Skip to content

Commit 80e70b9

Browse files
committed
cue: fix instance error handling
Change-Id: I58f26d6526ca2ff972caa3db97072e3dec113332 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/7066 Reviewed-by: CUE cueckoo <[email protected]> Reviewed-by: Marcel van Lohuizen <[email protected]>
1 parent 148f67a commit 80e70b9

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
! cue cmd print
2+
3+
cmp stderr expect-stderr
4+
5+
-- x_tool.cue --
6+
package x
7+
8+
import (
9+
"strings"
10+
"tool/cli"
11+
)
12+
13+
command: print: cli.Print & {
14+
text: "this is a test"
15+
}
16+
17+
-- expect-stderr --
18+
imported and not used: "strings":
19+
./x_tool.cue:4:5

cue/instance.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,10 @@ func (inst *Instance) Build(p *build.Instance) *Instance {
259259

260260
i := newInstance(idx, p, v)
261261
if rErr != nil {
262-
i.setListOrError(err)
262+
i.setListOrError(rErr)
263263
}
264264
if i.Err != nil {
265-
i.setListOrError(err)
265+
i.setListOrError(i.Err)
266266
}
267267

268268
if err != nil {

0 commit comments

Comments
 (0)