internal/encoding/gotypes: better support for CUE versus Go package names
Given one source directory, we might have CUE and Go packages
with different names, so we can't naively generate a Go package
with the same name as the original CUE package in the general case.
Worse, one directory can contain multiple CUE packages but only
one Go package, so we cannot generate multiple Go packages one-to-one.
Support package-level `@go()` attributes to tell the generator
which Go package name to use instead of the default naive behavior.
Note that we also need to move away from the naive cue_gen.go filenames,
as that causes conflicts when multiple CUE packages share one directory.
Use cue_types_${cuepkgname}.go instead.
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: Idc42aa70de3a1223451e6dc9289a7cebd33f465b
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1207310
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>