Skip to content

cmd/cue: fix seems to add duplicated imports if already present #3408

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

Closed
mvdan opened this issue Aug 30, 2024 · 0 comments
Closed

cmd/cue: fix seems to add duplicated imports if already present #3408

mvdan opened this issue Aug 30, 2024 · 0 comments
Assignees
Labels

Comments

@mvdan
Copy link
Member

mvdan commented Aug 30, 2024

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

Same as #3405.

Does this issue reproduce with the latest stable release?

Probably; not sure. This relates to the "fix" that @cuematthew is adding now for list arithmetic.

What did you do?

exec cue fix ./...
cmp good/good.cue good/good.cue.fixed

-- good/good.cue --
package good

import "list"

out1: ["foo"] + ["bar"]
out2: list.Repeat(["na"], 10)
-- good/good.cue.fixed --
package good

import "list"

out1: list.Concat([["foo"], ["bar"]])
out2: list.Repeat(["na"], 10)

What did you expect to see?

The testscript should pass.

What did you see instead?

It seems to want to add an import of list6c6973 "list" next to "list", presumably not realising that it's redundant and harmful.

> exec cue fix ./...
> cmp good/good.cue good/good.cue.fixed
diff good/good.cue good/good.cue.fixed
--- good/good.cue
+++ good/good.cue.fixed
@@ -1,9 +1,6 @@
-package p
-
-import (
-	"list"
-	list6c6973 "list"
-)
-
-out1: list6c6973.Concat([["foo"], ["bar"]])
+package good
+
+import "list"
+
+out1: list.Concat([["foo"], ["bar"]])
 out2: list.Repeat(["na"], 10)

FAIL: repro-cmd.txtar:2: good/good.cue and good/good.cue.fixed differ

Again, found when trying to use cue fix ./... on Unity projects.

@mvdan mvdan added the NeedsFix label Aug 30, 2024
@cuematthew cuematthew self-assigned this Sep 2, 2024
@cueckoo cueckoo closed this as completed in 1440b9e Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants