...
1package pkg1
2
3import (
4 "math"
5 "strings"
6 "cuelang.org/go/encoding/gocode/testdata/pkg2"
7)
8
9MyStruct: {
10 A: <=10
11 B: =~"cat" | *"dog"
12 O?: OtherStruct
13 I: pkg2.ImportMe
14} @go(,complete=Complete)
15
16OtherStruct: {
17 A: strings.ContainsAny("X")
18 P: pkg2.PickMe
19}
20
21String: !="" @go(,validate=ValidateCUE)
22
23SpecialString: =~"special" @go(,type=string)
24
25IgnoreThis: =~"foo" // No corresponding Go type
26
27Omit: int @go(-)
28
29// NonExisting will be omitted as there is no equivalent Go type.
30NonExisting: {
31 B: string
32} @go(-)
33
34// ignore unexported unless explicitly enabled.
35foo: int
36
37Ptr: {
38 A: math.MultipleOf(10)
39}
View as plain text