Skip to content

cmd/cue: help embed documentation says nothing about module-containment requirement #3788

@myitcv

Description

@myitcv

What page were you looking at?

https://cuelang.org/docs/reference/command/cue-help-embed/

What version of the site were you looking at?

cue version v0.13.0-0.dev.0.20250227123918-a0c6dfeb4553

go version go1.24.0
      -buildmode exe
       -compiler gc
  DefaultGODEBUG gotestjsonbuildtext=1,multipathtcp=0,randseednop=0,rsa1024min=0,tlsmlkem=0,x509rsacrt=0,x509usepolicies=0
     CGO_ENABLED 1
          GOARCH arm64
            GOOS linux
         GOARM64 v8.0
             vcs git
    vcs.revision a0c6dfeb45535f87f9dae70d8b9cec9e8f10e67e
        vcs.time 2025-02-27T12:39:18Z
    vcs.modified false
cue.lang.version v0.13.0

cue-lang/cuelang.org@460d21b

What did you do?

Read the above page and tried to run:

exec cue export .

-- a.json --
{
    "aField": "a value"
}
-- x.cue --
@extern(embed)

package p

manyFiles: _ @embed(glob=*.json)

What did you expect?

The test to pass.

What did you see instead?

> exec cue export .
[stderr]
cannot embed files when not in a module
[exit status 1]
FAIL: /tmp/testscript1354656307/repro.txtar/script.txtar:1: unexpected command failure

The help text for embed should call out that, by design, embed files can only be loaded from within a CUE module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions