this repo has no description
0
fork

Configure Feed

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

cmd/cue: parse module.cue file in non-strict mode

We do not want to prevent editing a module.cue file
when the strictness criteria are not met.

Fixes #3211.

Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I31991846db9a1815eeaa4cc41720e0943e74e4a0
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1196180
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>

+16 -6
+1 -1
cmd/cue/cmd/modedit.go
··· 77 77 if err != nil { 78 78 return err 79 79 } 80 - mf, err := modfile.Parse(data, modPath) 80 + mf, err := modfile.ParseNonStrict(data, modPath) 81 81 if err != nil { 82 82 return err 83 83 }
+15 -5
cmd/cue/cmd/testdata/script/modedit_nonstrict.txtar
··· 1 1 # This test checks that cue mod edit works OK even when the 2 2 # module file doesn't conform to the strict parsing. 3 - # TODO fix this to pass. 4 - ! exec cue mod edit --source self 5 - cmpenv stderr want-stderr 3 + exec cue mod edit --source self 4 + cmp cue.mod/module.cue want-module 6 5 7 6 -- cue.mod/module.cue -- 8 7 module: "main.org" 9 8 deps: "foo.com": v: "v1.2.3" 10 9 language: version: "v0.9.0-alpha.0" 11 - -- want-stderr -- 12 - invalid module.cue file $WORK${/}cue.mod${/}module.cue: no major version in "foo.com" 10 + -- want-module -- 11 + module: "main.org" 12 + language: { 13 + version: "v0.9.0-alpha.0" 14 + } 15 + source: { 16 + kind: "self" 17 + } 18 + deps: { 19 + "foo.com": { 20 + v: "v1.2.3" 21 + } 22 + }