Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
cmd/cue/cmd: fix resolution of hidden values across tools
Browse files Browse the repository at this point in the history
Bug only manifested in combination with modules.

Fixes #924

Change-Id: I8bdfd4975e065e4fa2fbc967fcc8f06b31f82d49
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9524
Reviewed-by: CUE cueckoo <[email protected]>
Reviewed-by: Marcel van Lohuizen <[email protected]>
  • Loading branch information
mpvl committed Apr 28, 2021
1 parent 3347302 commit 89abc18
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cmd/cue/cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,9 @@ func buildTools(cmd *Command, tags, args []string) (*cue.Instance, error) {
}
}

// Set path equal to the package from which it is loading.
ti.ImportPath = binst[0].ImportPath

inst = inst.Build(ti)
return inst, inst.Err
}
Expand Down
21 changes: 20 additions & 1 deletion cmd/cue/cmd/testdata/script/cmd_echo.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
cue cmd echo
stdout 'Hello World!'

cue cmd echohidden
stdout 'Hello World!'

-- cue.mod/module.cue --
module: "example.com/foo"

-- data.cue --
package hello

Expand All @@ -24,4 +30,17 @@ command: echo: {
text: echo.stdout
}
}
-- cue.mod --

// Issue #924
command: echohidden: {
echo: {
kind: "exec"
cmd: "echo Hello \(_who)!"
stdout: string
}

task: display: {
kind: "print"
text: echo.stdout
}
}

0 comments on commit 89abc18

Please sign in to comment.