cue: support multierror return from Unify

Also fixes:
- file naming issue in Marshalling, which was not
  relative to the module root, if available.
- gocode generated output was not checked
  against golden (which was only used in gen_test.go)

Change-Id: I6a5f5363e2d0656ef3935fc46f84444ccbdd9a3e
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2942
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/encoding/gocode/gen_test.go b/encoding/gocode/gen_test.go
index 6f01c2b..d1bb8c2 100644
--- a/encoding/gocode/gen_test.go
+++ b/encoding/gocode/gen_test.go
@@ -42,7 +42,7 @@
 			v := &pkg1.OtherStruct{A: "car"}
 			return v.Validate()
 		}(),
-		want: "A: invalid value \"car\" (does not satisfy strings.ContainsAny(\"X\")):\n    pkg1/instance.cue:x:x",
+		want: "A: invalid value \"car\" (does not satisfy strings.ContainsAny(\"X\")):\n    pkg1/instance.cue:x:x\nP: invalid value 0 (out of bound >5):\n    pkg2/instance.cue:x:x",
 	}, {
 		name: "failing field of type int",
 		got: func() error {
@@ -53,7 +53,7 @@
 	}, {
 		name: "failing nested struct ",
 		got: func() error {
-			v := &pkg1.MyStruct{A: 5, B: "dog", O: &pkg1.OtherStruct{A: "car"}}
+			v := &pkg1.MyStruct{A: 5, B: "dog", O: &pkg1.OtherStruct{A: "car", P: 6}}
 			return v.Validate()
 		}(),
 		want: "O.A: invalid value \"car\" (does not satisfy strings.ContainsAny(\"X\")):\n    pkg1/instance.cue:x:x",