this repo has no description
0
fork

Configure Feed

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

cmd/cue: stop creating cue.mod/pkg and cue.mod/usr in `cue mod init`

Placing packages in cue.mod/pkg predates the introduction of
CUE modules and OCI-based module registries,
as documented in https://cuelang.org/docs/reference/modules/.

Nowadays, rather than manually placing packages in cue.mod/pkg,
the user is expected to `cue mod get` dependencies
and have them transparently fetched into ${CUE_CACHE_DIR}/mod.
Hence, most CUE users creating new modules should not need cue.mod/pkg.
Creating the directory at this point is more likely to confuse
new CUE users rather than be helpful, and if anyone does still need
to use the old dependency mechanism, it's easy to create one directory.

The same goes for cue.mod/usr, which was used to unify with packages
present in cue.mod/pkg.

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

+7 -14
+1 -8
cmd/cue/cmd/modinit.go
··· 97 97 return err 98 98 } 99 99 100 - if err = os.Mkdir(filepath.Join(mod, "usr"), 0777); err != nil { 101 - return err 102 - } 103 - if err = os.Mkdir(filepath.Join(mod, "pkg"), 0777); err != nil { 104 - return err 105 - } 106 - 107 - return err 100 + return nil 108 101 }
+2 -2
cmd/cue/cmd/testdata/script/modinit_majorversion.txtar
··· 4 4 rm cue.mod 5 5 exec cue mod init foo.com/bar@v1 6 6 cmp cue.mod/module.cue want-module-experiment.cue 7 - exists cue.mod/usr 8 - exists cue.mod/pkg 7 + ! exists cue.mod/usr 8 + ! exists cue.mod/pkg 9 9 10 10 -- want-module.cue -- 11 11 module: "foo.com/bar@v1"
+2 -2
cmd/cue/cmd/testdata/script/modinit_noargs.txtar
··· 1 1 exec cue mod init 2 2 env-fill want-module.cue 3 3 cmp cue.mod/module.cue want-module.cue 4 - exists cue.mod/usr 5 - exists cue.mod/pkg 4 + ! exists cue.mod/usr 5 + ! exists cue.mod/pkg 6 6 7 7 -- want-module.cue -- 8 8 module: "cue.example"
+2 -2
cmd/cue/cmd/testdata/script/modinit_nomajorversion.txtar
··· 6 6 # with earlier cue versions. 7 7 exec cue mod init foo.com/bar 8 8 cmp cue.mod/module.cue want-module-experiment.cue 9 - exists cue.mod/usr 10 - exists cue.mod/pkg 9 + ! exists cue.mod/usr 10 + ! exists cue.mod/pkg 11 11 12 12 -- want-module.cue -- 13 13 module: "foo.com/bar"