cue icon indicating copy to clipboard operation
cue copied to clipboard

cue: cue def --inline-imports still retains an import

Open rogpeppe opened this issue 1 year ago • 0 comments

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

$ cue version
v0.11.0-alpha.3.0.20241008151848-ee2205537250

Does this issue reproduce with the latest stable release?

Yes (v0.10.0)

What did you do?

exec cue def --inline-imports ./p0
! stdout '^	"example\.test'
-- cue.mod/module.cue --
module: "example.test"
language: version: "v0.10.0"
-- p0/ecs.cue --
package p0

import (
	"encoding/json"
	"example.test/p1"
)

#T: {
	a: _
	policy: json.Marshal({
			let arns = {
				for _, container in a
				for _, v in container.env
				if (v & p1.#S) != _|_ {}
			}
			arns
	})
}
-- p1/x.cue --
package p1

#S: {...}

What did you expect to see?

Passing test. The output of cue def --inline-imports should inline all non-stdlib imports.

What did you see instead?

> exec cue def --inline-imports ./p0
[stdout]
package p0

import (
	"encoding/json"
	"example.test/p1"
)

#T: {
	a: _
	policy: json.Marshal({
		let arns = {
			for _, container in a
			for _, v in container.env
			if (v & p1.#S) != _|_ // explicit error (_|_ literal) in source
			{}
		}
		arns
	}) & {}
}
> ! stdout '^	"example\.test'
FAIL: /tmp/y.txtar:2: unexpected match for `^	"example\.test` found in stdout: 	"example.test

rogpeppe avatar Oct 08 '24 18:10 rogpeppe