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

cmd/cue: exp gengotypes output filenames vary based on CUE module presence #3765

Open
jpluscplusm opened this issue Feb 17, 2025 · 0 comments
Assignees
Labels
NeedsInvestigation Triage Requires triage/attention

Comments

@jpluscplusm
Copy link
Collaborator

jpluscplusm commented Feb 17, 2025

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

$ cue version
cue version v0.13.0-0.dev.0.20250217164507-bb1be011fa01

go version go1.23.5
      -buildmode exe
       -compiler gc
     CGO_ENABLED 1
          GOARCH amd64
            GOOS linux
         GOAMD64 v1
cue.lang.version v0.13.0

Does this issue reproduce with the latest stable release?

Yes, v0.12.0.

What did you do?

# Inside a CUE module.
exec cue mod init
exec cue exp gengotypes .:foo
exec find . -type f -name *.go
cmp stdout files

# Reset state.
rm -rf cue.mod
rm cue_types_foo_gen.go

# Not inside a CUE module.
exec cue exp gengotypes .:foo
exec find . -type f -name *.go
cmp stdout files

-- file.cue --
package foo

#X: int
-- files --
./cue_types_foo_gen.go

What did you expect to see?

A passing test indicating that, when invoked outside a CUE module, cue exp gogentypes emitted a Go file whose name encoded the CUE package name for which it was being called.

What did you see instead?

# Inside a CUE module. (0.042s)
# Reset state. (0.000s)
# Not inside a CUE module. (0.018s)
> exec cue exp gengotypes .:foo
> exec find . -type f -name *.go
[stdout]
./cue_types_gen.go
> cmp stdout files
diff stdout files
--- stdout
+++ files
@@ -1,1 +1,1 @@
-./cue_types_gen.go
+./cue_types_foo_gen.go

FAIL: cue.exp.gengotypes.outFilenameVaries.txtar:14: stdout and files differ
@jpluscplusm jpluscplusm added NeedsInvestigation Triage Requires triage/attention labels Feb 17, 2025
@mvdan mvdan self-assigned this Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Triage Requires triage/attention
Projects
None yet
Development

No branches or pull requests

2 participants