Skip to content

Commit ddca816

Browse files
denikIsaac
andcommitted
libs/dyn: remove what the load path does not use
dynvar, yamlsaver, jsonloader, dynloc, the pattern trie and pattern strings, the read-only walk, and the element-merge, override and select helpers of merge have no users left. convert uses structvar to recognize a pure reference. Co-authored-by: Isaac <no-reply@databricks.com>
1 parent a6dfaf8 commit ddca816

27 files changed

Lines changed: 24 additions & 3403 deletions

‎libs/dyn/convert/from_typed.go‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"slices"
77

88
"github.com/databricks/cli/libs/dyn"
9-
"github.com/databricks/cli/libs/dyn/dynvar"
9+
"github.com/databricks/cli/libs/structs/structvar"
1010
)
1111

1212
type fromTypedOptions int
@@ -96,7 +96,7 @@ func fromTypedStruct(src reflect.Value, ref dyn.Value, options ...fromTypedOptio
9696
switch ref.Kind() {
9797
case dyn.KindString:
9898
// Ignore pure variable references (e.g. ${var.foo}).
99-
if dynvar.IsPureVariableReference(ref.MustString()) {
99+
if structvar.IsPureVariableReference(ref.MustString()) {
100100
return ref, nil
101101
}
102102
case dyn.KindMap, dyn.KindNil:
@@ -174,7 +174,7 @@ func fromTypedMap(src reflect.Value, ref dyn.Value) (dyn.Value, error) {
174174
switch ref.Kind() {
175175
case dyn.KindString:
176176
// Ignore pure variable references (e.g. ${var.foo}).
177-
if dynvar.IsPureVariableReference(ref.MustString()) {
177+
if structvar.IsPureVariableReference(ref.MustString()) {
178178
return ref, nil
179179
}
180180
case dyn.KindMap, dyn.KindNil:
@@ -222,7 +222,7 @@ func fromTypedSlice(src reflect.Value, ref dyn.Value) (dyn.Value, error) {
222222
switch ref.Kind() {
223223
case dyn.KindString:
224224
// Ignore pure variable references (e.g. ${var.foo}).
225-
if dynvar.IsPureVariableReference(ref.MustString()) {
225+
if structvar.IsPureVariableReference(ref.MustString()) {
226226
return ref, nil
227227
}
228228
case dyn.KindSequence, dyn.KindNil:
@@ -297,7 +297,7 @@ func fromTypedBool(src reflect.Value, ref dyn.Value, options ...fromTypedOptions
297297
return dyn.V(src.Bool()), nil
298298
case dyn.KindString:
299299
// Ignore pure variable references (e.g. ${var.foo}).
300-
if dynvar.IsPureVariableReference(ref.MustString()) {
300+
if structvar.IsPureVariableReference(ref.MustString()) {
301301
return ref, nil
302302
}
303303
default:
@@ -324,7 +324,7 @@ func fromTypedInt(src reflect.Value, ref dyn.Value, options ...fromTypedOptions)
324324
return dyn.V(src.Int()), nil
325325
case dyn.KindString:
326326
// Ignore pure variable references (e.g. ${var.foo}).
327-
if dynvar.IsPureVariableReference(ref.MustString()) {
327+
if structvar.IsPureVariableReference(ref.MustString()) {
328328
return ref, nil
329329
}
330330
default:
@@ -351,7 +351,7 @@ func fromTypedFloat(src reflect.Value, ref dyn.Value, options ...fromTypedOption
351351
return dyn.V(src.Float()), nil
352352
case dyn.KindString:
353353
// Ignore pure variable references (e.g. ${var.foo}).
354-
if dynvar.IsPureVariableReference(ref.MustString()) {
354+
if structvar.IsPureVariableReference(ref.MustString()) {
355355
return ref, nil
356356
}
357357
default:

‎libs/dyn/convert/normalize.go‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
"github.com/databricks/cli/libs/diag"
1010
"github.com/databricks/cli/libs/dyn"
11-
"github.com/databricks/cli/libs/dyn/dynvar"
11+
"github.com/databricks/cli/libs/structs/structvar"
1212
)
1313

1414
// NormalizeOption is the type for options that can be passed to Normalize.
@@ -242,7 +242,7 @@ func (n normalizeOptions) normalizeStruct(typ reflect.Type, src dyn.Value, seen
242242

243243
case dyn.KindString:
244244
// Return verbatim if it's a pure variable reference.
245-
if dynvar.IsPureVariableReference(src.MustString()) {
245+
if structvar.IsPureVariableReference(src.MustString()) {
246246
return src, nil
247247
}
248248
default:
@@ -282,7 +282,7 @@ func (n normalizeOptions) normalizeMap(typ reflect.Type, src dyn.Value, seen []r
282282

283283
case dyn.KindString:
284284
// Return verbatim if it's a pure variable reference.
285-
if dynvar.IsPureVariableReference(src.MustString()) {
285+
if structvar.IsPureVariableReference(src.MustString()) {
286286
return src, nil
287287
}
288288
default:
@@ -319,7 +319,7 @@ func (n normalizeOptions) normalizeSlice(typ reflect.Type, src dyn.Value, seen [
319319

320320
case dyn.KindString:
321321
// Return verbatim if it's a pure variable reference.
322-
if dynvar.IsPureVariableReference(src.MustString()) {
322+
if structvar.IsPureVariableReference(src.MustString()) {
323323
return src, nil
324324
}
325325
default:
@@ -369,7 +369,7 @@ func (n normalizeOptions) normalizeBool(typ reflect.Type, src dyn.Value, path dy
369369
return dyn.NewValue(false, src.Locations()), nil
370370
default:
371371
// Return verbatim if it's a pure variable reference.
372-
if dynvar.IsPureVariableReference(src.MustString()) {
372+
if structvar.IsPureVariableReference(src.MustString()) {
373373
return src, nil
374374
}
375375

@@ -408,7 +408,7 @@ func (n normalizeOptions) normalizeInt(typ reflect.Type, src dyn.Value, path dyn
408408
out, err := strconv.ParseInt(src.MustString(), 10, 64)
409409
if err != nil {
410410
// Return verbatim if it's a pure variable reference.
411-
if dynvar.IsPureVariableReference(src.MustString()) {
411+
if structvar.IsPureVariableReference(src.MustString()) {
412412
return src, nil
413413
}
414414

@@ -452,7 +452,7 @@ func (n normalizeOptions) normalizeFloat(typ reflect.Type, src dyn.Value, path d
452452
out, err := strconv.ParseFloat(src.MustString(), 64)
453453
if err != nil {
454454
// Return verbatim if it's a pure variable reference.
455-
if dynvar.IsPureVariableReference(src.MustString()) {
455+
if structvar.IsPureVariableReference(src.MustString()) {
456456
return src, nil
457457
}
458458

‎libs/dyn/convert/sdk_native_types.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"slices"
88

99
"github.com/databricks/cli/libs/dyn"
10-
"github.com/databricks/cli/libs/dyn/dynvar"
10+
"github.com/databricks/cli/libs/structs/structvar"
1111
sdkduration "github.com/databricks/databricks-sdk-go/common/types/duration"
1212
sdkfieldmask "github.com/databricks/databricks-sdk-go/common/types/fieldmask"
1313
sdktime "github.com/databricks/databricks-sdk-go/common/types/time"
@@ -30,7 +30,7 @@ func fromTypedSDKNative(src reflect.Value, ref dyn.Value, options ...fromTypedOp
3030
switch ref.Kind() {
3131
case dyn.KindString:
3232
// Ignore pure variable references (e.g. ${var.foo}).
33-
if dynvar.IsPureVariableReference(ref.MustString()) {
33+
if structvar.IsPureVariableReference(ref.MustString()) {
3434
return ref, nil
3535
}
3636
case dyn.KindNil:
@@ -72,7 +72,7 @@ func toTypedSDKNative(dst reflect.Value, src dyn.Value) error {
7272
switch src.Kind() {
7373
case dyn.KindString:
7474
// Ignore pure variable references (e.g. ${var.foo}).
75-
if dynvar.IsPureVariableReference(src.MustString()) {
75+
if structvar.IsPureVariableReference(src.MustString()) {
7676
dst.SetZero()
7777
return nil
7878
}

‎libs/dyn/convert/to_typed.go‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strconv"
88

99
"github.com/databricks/cli/libs/dyn"
10-
"github.com/databricks/cli/libs/dyn/dynvar"
10+
"github.com/databricks/cli/libs/structs/structvar"
1111
)
1212

1313
// Populate a destination typed value from a source dynamic value.
@@ -118,7 +118,7 @@ func toTypedStruct(dst reflect.Value, src dyn.Value) error {
118118
return nil
119119
case dyn.KindString:
120120
// Ignore pure variable references (e.g. ${var.foo}).
121-
if dynvar.IsPureVariableReference(src.MustString()) {
121+
if structvar.IsPureVariableReference(src.MustString()) {
122122
dst.SetZero()
123123
return nil
124124
}
@@ -175,7 +175,7 @@ func toTypedMap(dst reflect.Value, src dyn.Value) error {
175175
return nil
176176
case dyn.KindString:
177177
// Ignore pure variable references (e.g. ${var.foo}).
178-
if dynvar.IsPureVariableReference(src.MustString()) {
178+
if structvar.IsPureVariableReference(src.MustString()) {
179179
dst.SetZero()
180180
return nil
181181
}
@@ -208,7 +208,7 @@ func toTypedSlice(dst reflect.Value, src dyn.Value) error {
208208
return nil
209209
case dyn.KindString:
210210
// Ignore pure variable references (e.g. ${var.foo}).
211-
if dynvar.IsPureVariableReference(src.MustString()) {
211+
if structvar.IsPureVariableReference(src.MustString()) {
212212
dst.SetZero()
213213
return nil
214214
}
@@ -262,7 +262,7 @@ func toTypedBool(dst reflect.Value, src dyn.Value) error {
262262
return nil
263263
}
264264
// Ignore pure variable references (e.g. ${var.foo}).
265-
if dynvar.IsPureVariableReference(src.MustString()) {
265+
if structvar.IsPureVariableReference(src.MustString()) {
266266
dst.SetZero()
267267
return nil
268268
}
@@ -300,7 +300,7 @@ func toTypedInt(dst reflect.Value, src dyn.Value) error {
300300
return nil
301301
}
302302
// Ignore pure variable references (e.g. ${var.foo}).
303-
if dynvar.IsPureVariableReference(src.MustString()) {
303+
if structvar.IsPureVariableReference(src.MustString()) {
304304
dst.SetZero()
305305
return nil
306306
}
@@ -325,7 +325,7 @@ func toTypedFloat(dst reflect.Value, src dyn.Value) error {
325325
return nil
326326
}
327327
// Ignore pure variable references (e.g. ${var.foo}).
328-
if dynvar.IsPureVariableReference(src.MustString()) {
328+
if structvar.IsPureVariableReference(src.MustString()) {
329329
dst.SetZero()
330330
return nil
331331
}

‎libs/dyn/dynvar/lookup.go‎

Lines changed: 0 additions & 21 deletions
This file was deleted.

‎libs/dyn/dynvar/lookup_test.go‎

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)