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/interpreter/embed: support embed attribute appearing multiple times for single field declaration? #3294

Open
myitcv opened this issue Jul 16, 2024 · 1 comment

Comments

@myitcv
Copy link
Member

myitcv commented Jul 16, 2024

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

$ cue version
cue version v0.0.0-20240712164527-719893f23850

go version go1.22.3
      -buildmode exe
       -compiler gc
  DefaultGODEBUG httplaxcontentlength=1,httpmuxgo121=1,tls10server=1,tlsrsakex=1,tlsunsafeekm=1
     CGO_ENABLED 1
          GOARCH arm64
            GOOS linux
             vcs git
    vcs.revision 719893f23850172d224720e6d1257586179ac895
        vcs.time 2024-07-12T16:45:27Z
    vcs.modified false
cue.lang.version v0.10.0

Does this issue reproduce with the latest release?

Yes

What did you do?

env CUE_EXPERIMENT=embed
exec cue export x.cue
cmp stdout stdout.golden

-- x.cue --
@extern(embed)

package x

f: _ @embed(glob=*.json) @embed(glob=*.yaml)

-- x.json --
5

-- x.yaml --
test

-- stdout.golden --
{
    "f": {
        "x.json": 5,
        "x.yaml": "test"
    }
}

What did you expect to see?

Passing test, at least based on the conversations we had regarding #3264 that I recall.

What did you see instead?

> env CUE_EXPERIMENT=embed
> exec cue export x.cue
[stderr]
duplicate @embed attributes:
    ./x.cue:5:26
[exit status 1]
FAIL: /tmp/testscript174121000/repro.txtar/script.txtar:2: unexpected command failure
@myitcv
Copy link
Member Author

myitcv commented Jul 16, 2024

The workaround for now is to declare the field multiple times:

env CUE_EXPERIMENT=embed
exec cue export x.cue
cmp stdout stdout.golden

-- x.cue --
@extern(embed)

package x

f: _ @embed(glob=*.json)
f: _ @embed(glob=*.yaml)

-- x.json --
5

-- x.yaml --
test

-- stdout.golden --
{
    "f": {
        "x.json": 5,
        "x.yaml": "test"
    }
}

@myitcv myitcv changed the title cue/interpreter/embed: support embed attribute appearing multiple times missing? cue/interpreter/embed: support embed attribute appearing multiple times for single field declaration? Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant