File tree Expand file tree Collapse file tree 2 files changed +4
-13
lines changed Expand file tree Collapse file tree 2 files changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ func (c *Context) Constrain(x interface{}, constraints string) error {
140
140
return err
141
141
}
142
142
143
- v := instance . Eval (expr )
143
+ v := runtime . BuildExpr (expr )
144
144
if v .Err () != nil {
145
145
return err
146
146
}
@@ -158,19 +158,10 @@ func (c *Context) Constrain(x interface{}, constraints string) error {
158
158
}
159
159
160
160
var (
161
- mutex sync.Mutex
162
- instance * cue.Instance
163
- runtime = cuecontext .New ()
161
+ mutex sync.Mutex
162
+ runtime = cuecontext .New ()
164
163
)
165
164
166
- func init () {
167
- var err error
168
- instance , err = value .ConvertToRuntime (runtime ).Compile ("<cuego>" , "{}" )
169
- if err != nil {
170
- panic (err )
171
- }
172
- }
173
-
174
165
// fromGoValue converts a Go value to CUE
175
166
func fromGoValue (x interface {}, nilIsNull bool ) (v cue.Value , err error ) {
176
167
// TODO: remove the need to have a lock here. We could use a new index (new
Original file line number Diff line number Diff line change 54
54
// A Complete will implicitly validate a struct.
55
55
package cuego // import "cuelang.org/go/cuego"
56
56
57
- // The first goal of this packages is to get the semantics right. After that,
57
+ // The first goal of this package is to get the semantics right. After that,
58
58
// there are a lot of performance gains to be made:
59
59
// - cache the type info extracted during value (as opposed to type) conversion
60
60
// - remove the usage of mutex for value conversions
You can’t perform that action at this time.
0 commit comments