cue: ignore fields of Go types unmappable to CUE
Change-Id: Iaf1595a4f70c330eca757d393092f5591a1debc2
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2542
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/go.go b/cue/go.go
index cdf21db..5daeb2c 100644
--- a/cue/go.go
+++ b/cue/go.go
@@ -482,6 +482,9 @@
}
_, ok := f.Tag.Lookup("cue")
elem := goTypeToValue(ctx, !ok, f.Type)
+ if elem == nil {
+ continue // Ignore fields for unsupported types
+ }
// leave errors like we do during normal evaluation or do we
// want to return the error?
diff --git a/cue/go_test.go b/cue/go_test.go
index 441d84c..b608fe4 100644
--- a/cue/go_test.go
+++ b/cue/go_test.go
@@ -159,6 +159,7 @@
F float64
L []byte
T time.Time
+ G func()
}{},
`(*null | <0>{A: ((int & >=-32768 & int & <=32767) & (>=0 & <100)), ` +
`C: string, ` +