...

Source file src/cuelang.org/go/encoding/gocode/testdata/pkg2/cue_gen.go

Documentation: cuelang.org/go/encoding/gocode/testdata/pkg2

     1  // Code generated by gocode.Generate; DO NOT EDIT.
     2  
     3  package pkg2
     4  
     5  import (
     6  	"fmt"
     7  
     8  	"cuelang.org/go/cue"
     9  	"cuelang.org/go/encoding/gocode/gocodec"
    10  	_ "cuelang.org/go/pkg"
    11  )
    12  
    13  var cuegenvalImportMe = cuegenMake("ImportMe", &ImportMe{})
    14  
    15  // Validate validates x.
    16  func (x *ImportMe) Validate() error {
    17  	return cuegenCodec.Validate(cuegenvalImportMe, x)
    18  }
    19  
    20  var cuegenvalPickMe = cuegenMake("PickMe", nil)
    21  
    22  // Validate validates x.
    23  func (x PickMe) Validate() error {
    24  	return cuegenCodec.Validate(cuegenvalPickMe, x)
    25  }
    26  
    27  var cuegenCodec, cuegenInstance_, cuegenValue = func() (*gocodec.Codec, *cue.Instance, cue.Value) {
    28  	var r *cue.Runtime
    29  	r = &cue.Runtime{}
    30  	instances, err := r.Unmarshal(cuegenInstanceData)
    31  	if err != nil {
    32  		panic(err)
    33  	}
    34  	if len(instances) != 1 {
    35  		panic("expected encoding of exactly one instance")
    36  	}
    37  	return gocodec.New(r, nil), instances[0], instances[0].Value()
    38  }()
    39  
    40  // Deprecated: cue.Instance is deprecated. Use cuegenValue instead.
    41  var cuegenInstance = cuegenInstance_
    42  
    43  // cuegenMake is called in the init phase to initialize CUE values for
    44  // validation functions.
    45  func cuegenMake(name string, x interface{}) cue.Value {
    46  	f, err := cuegenValue.FieldByName(name, true)
    47  	if err != nil {
    48  		panic(fmt.Errorf("could not find type %q in instance", name))
    49  	}
    50  	v := f.Value
    51  	if x != nil {
    52  		w, err := cuegenCodec.ExtractType(x)
    53  		if err != nil {
    54  			panic(err)
    55  		}
    56  		v = v.Unify(w)
    57  	}
    58  	return v
    59  }
    60  
    61  // Data size: 274 bytes.
    62  var cuegenInstanceData = []byte("\x01\x1f\x8b\b\x00\x00\x00\x00\x00\x00\xffD\x8e\xc1J\x031\x10\x86\xe7\u07ee`C\x15|\x00a\xd9S\x05\u066d\x82\x1e\x8a\bU\x11<(\u016bx\x18\xd3\x18C\u06e44\u0643\x88\xa8\xb5\xfa8\xbeb$\xa5\xe2i\x86o\xe6\xff\xf9\xb6\xe2W\x86,~\x13\xe2;\xd1\xf1[\v\xe8\x18\xeb\x03[\xa9.8p\xc2h!\xbfu. #\xe4C\x0eO\xe8\x106.\xcdDy\xc4%\x11\xed\xc6\xcf\f\u063e\xbb\x97\x8d\xaa\x1e\xcdd\x9d\\\x12\u20a8\x1b?Z\xc0\xe6?_\x102\xe47<U\xa9(_AAD\xf1'y\x00\u0617\x8d\x9a\xb0\u0555\x9b\xebZ\xbbZY\xe9F\u01a6]\xba\x91\xaa\x83\xf2a\u0101\xeb\xd9X\x1f\x02\xd8I\xb3\xfe\u04eed\xa3\xc03\x96c\u05aaH'!\xcct\xe6\xe6\xa1(}\x98\x1b\xab})\xc4\u054a\\\xab~\xf1\"\u0683~qr\xd0\xeb\x89\xf6Y\xbfX\xbfT\xe7\xce\x066\xd6\x0f\xecs\xb7\xe4\aY\xee\x89W14r\x9c2\xa7G\x82\xe87\x00\x00\xff\xff\x8e\x9a[\x03<\x01\x00\x00")
    63  

View as plain text