cue icon indicating copy to clipboard operation
cue copied to clipboard

mod: allow imports of main module from within an excluded directory

Open rogpeppe opened this issue 1 year ago • 0 comments

What version of CUE are you using (cue version)?

$ cue version
v0.8.0

Does this issue reproduce with the latest stable release?

N/A

What did you do?

env CUE_EXPERIMENT=modules
cd src/_examples/example1
exec cue export .
cmp stdout $WORK/want-stdout

-- want-stdout --
{
    "fooValue": "yes"
}
-- src/cue.mod/module.cue --
module: "my-module.example/foo"
-- src/foo.cue --
package foo

value: "yes"
-- src/_examples/example1/example1.cue --
package example1

import "my-module.example/foo"

fooValue: foo.value

What did you expect to see?

A passing test.

What did you see instead?

> env CUE_EXPERIMENT=modules
> cd src/_examples/example1
$WORK/src/_examples/example1
> exec cue export .
[stderr]
import failed: no dependency found for package "my-module.example/foo":
    ./example1.cue:3:8
[exit status 1]
FAIL: /tmp/testscript650120674/x.txtar/script.txtar:3: unexpected command failure

Despite not being part of the module, it should probably be possible to evaluate code inside the _examples directory that imports packages from within the main module's dependencies.

rogpeppe avatar Mar 19 '24 11:03 rogpeppe