Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cue/load: using qualifier that is the same as final path element causes import failure #3162

Closed
rogpeppe opened this issue May 21, 2024 · 2 comments
Assignees
Labels
modules Issues related to CUE modules and the experimental implementation NeedsFix

Comments

@rogpeppe
Copy link
Member

rogpeppe commented May 21, 2024

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

a90aec5c611bda3d73dfe484d4794e07499ff2ae

Does this issue reproduce with the latest stable release?

Yes (at v0.8.2)

What did you do?

# old
env CUE_EXPERIMENT=modules=0
exec cue vet -c .

# new
env CUE_EXPERIMENT=modules
exec cue vet -c .

-- cue.mod/module.cue --
module: "github.com/foo/bar"
language: {
	version: "v0.9.0"
}
-- bar.cue --
package bar

import xxx "github.com/foo/bar/abc:abc"

z: xxx.x & 123

-- abc/baz.cue --
package abc

x: 123

What did you expect to see?

A passing test

What did you see instead?

# old (0.023s)
# new (0.011s)
> env CUE_EXPERIMENT=modules
> exec cue vet -c .
[stderr]
github.com/foo/bar@v0: import failed: no dependency found for package "github.com/foo/bar/abc":
    ./bar.cue:3:8
[exit status 1]
FAIL: /tmp/testscript3893947838/repro.txtar/script.txtar:7: unexpected command failure
@rogpeppe rogpeppe added NeedsFix modules Issues related to CUE modules and the experimental implementation labels May 21, 2024
@myitcv
Copy link
Member

myitcv commented May 23, 2024

It was ambiguous which vet call had failed, so I've updated the original description.

@rogpeppe - to confirm we will fix this as part of the work in #3155?

@rogpeppe
Copy link
Member Author

It was ambiguous which vet call had failed, so I've updated the original description.

@rogpeppe - to confirm we will fix this as part of the work in #3155?

The fix is actually independent of that, but I have a fix and it will land at or around the same time.

@mvdan mvdan self-assigned this May 30, 2024
cueckoo pushed a commit that referenced this issue May 30, 2024
Otherwise trying to load an import path with an unnecessary qualifier,
such as "mod.com/x:x", would be added to the map of known packages
under its canonical form "mod.com/x", but we would do the lookup
based on the original non-canonical import path, not finding a match.

Add reminders to the relevant places about the paths being canonical,
and use a separate variable for unqualified import paths for clarity.
The use of unqualified paths seems wrong to me too, so add a TODO.

Fixes #3162.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: Ifc748ce61420f501b08216662b647e5475822593
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
modules Issues related to CUE modules and the experimental implementation NeedsFix
Projects
Archived in project
Status: v0.9.0-rc.1
Development

No branches or pull requests

3 participants