this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cmd/cue: do not allow embedding of CUE file types (for now)

Per the design proposed in https://cuelang.org/discussion/3264, we do
not allow CUE file type embeds for now. This CL fixes the MVP
implementation to match that initial decision, along with removing the
attempted embed of a CUE file across a module boundary. Preventing
embedding of files across module boundaries is fixed in another CL, but
this change to not attempt the CUE file type embed is needed now, and
the case covered in embed_err.txtar.

Fixes #3258.

Signed-off-by: Paul Jolly <paul@myitcv.io>
Change-Id: Ic12297750620ade0cd631a56f73f16c3d0ca156e
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1197337
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+6 -12
-12
cmd/cue/cmd/testdata/script/embed.txtar
··· 44 44 // probably be up to the loader to provide a fs.FS that handles this 45 45 // according to spec. 46 46 nestedModJSON: _ @embed(file="a/b/foo.json") 47 - nestedModFile: _ @embed(file="a/b/cue.mod/modules.cue") 48 47 } 49 48 50 49 -- test.json -- ··· 124 123 underscoreDir: _ 125 124 dotDir: _ 126 125 nestedModJSON: _ 127 - nestedModFile: _ 128 126 } 129 127 -- out/eval -- 130 128 a: { ··· 219 217 a: 1 220 218 b: 2 221 219 } 222 - nestedModFile: { 223 - module: "acme.com" 224 - language: { 225 - version: "v0.9.0" 226 - } 227 - } 228 220 } 229 221 -- out/export -- 230 222 a: x: 34 ··· 284 276 nestedModJSON: { 285 277 a: 1 286 278 b: 2 287 - } 288 - nestedModFile: { 289 - module: "acme.com" 290 - language: version: "v0.9.0" 291 279 } 292 280 } 293 281 -- out/vet --
+4
cmd/cue/cmd/testdata/script/embed_err.txtar
··· 114 114 ./test.cue:39:10 115 115 @embed: open x\test.json: no such file or directory: 116 116 ./test.cue:41:18 117 + @embed: encoding "cue" not (yet) supported: 118 + ./test.cue:43:20 119 + @embed: encoding "cue" not (yet) supported: 120 + ./test.cue:44:24
+2
cue/interpreter/embed/embed.go
··· 303 303 } 304 304 305 305 switch f.Encoding { 306 + case build.CUE: 307 + return nil, errors.Newf(c.pos, "encoding %q not (yet) supported", f.Encoding) 306 308 case build.JSONL: 307 309 return nil, errors.Newf(c.pos, "encoding %q not (yet) supported: requires support for streaming", f.Encoding) 308 310 case build.BinaryProto, build.TextProto: