mirror of https://github.com/databricks/cli.git
Keep libs/dyn unchanged; annotate with //nolint:errcheck
This commit is contained in:
parent
3b99cdf21a
commit
16d412aa67
|
@ -126,8 +126,7 @@ func fromTypedStruct(src reflect.Value, ref dyn.Value, options ...fromTypedOptio
|
||||||
|
|
||||||
// Either if the key was set in the reference or the field is not zero-valued, we include it.
|
// Either if the key was set in the reference or the field is not zero-valued, we include it.
|
||||||
if ok || nv.Kind() != dyn.KindNil {
|
if ok || nv.Kind() != dyn.KindNil {
|
||||||
// QQQ log error?
|
out.Set(refk, nv) // nolint:errcheck
|
||||||
_ = out.Set(refk, nv)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,8 +184,7 @@ func fromTypedMap(src reflect.Value, ref dyn.Value) (dyn.Value, error) {
|
||||||
|
|
||||||
// Every entry is represented, even if it is a nil.
|
// Every entry is represented, even if it is a nil.
|
||||||
// Otherwise, a map with zero-valued structs would yield a nil as well.
|
// Otherwise, a map with zero-valued structs would yield a nil as well.
|
||||||
// QQQ log error?
|
out.Set(refk, nv) //nolint:errcheck
|
||||||
_ = out.Set(refk, nv)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return dyn.V(out), nil
|
return dyn.V(out), nil
|
||||||
|
|
|
@ -116,9 +116,7 @@ func (n normalizeOptions) normalizeStruct(typ reflect.Type, src dyn.Value, seen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := out.Set(pk, nv); err != nil {
|
out.Set(pk, nv) //nolint:errcheck
|
||||||
return dyn.InvalidValue, diag.FromErr(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the normalized value if missing fields are not included.
|
// Return the normalized value if missing fields are not included.
|
||||||
|
@ -164,9 +162,7 @@ func (n normalizeOptions) normalizeStruct(typ reflect.Type, src dyn.Value, seen
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if v.IsValid() {
|
if v.IsValid() {
|
||||||
if err := out.Set(dyn.V(k), v); err != nil {
|
out.Set(dyn.V(k), v) // nolint:errcheck
|
||||||
return dyn.InvalidValue, diag.FromErr(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,9 +201,7 @@ func (n normalizeOptions) normalizeMap(typ reflect.Type, src dyn.Value, seen []r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := out.Set(pk, nv); err != nil {
|
out.Set(pk, nv) //nolint:errcheck
|
||||||
return dyn.InvalidValue, diag.FromErr(err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return dyn.NewValue(out, src.Locations()), diags
|
return dyn.NewValue(out, src.Locations()), diags
|
||||||
|
|
|
@ -70,8 +70,7 @@ func decodeValue(decoder *json.Decoder, o *Offset) (dyn.Value, error) {
|
||||||
return invalidValueWithLocation(decoder, o), err
|
return invalidValueWithLocation(decoder, o), err
|
||||||
}
|
}
|
||||||
|
|
||||||
// QQQ log this?
|
obj.Set(keyVal, val) //nolint:errcheck
|
||||||
_ = obj.Set(keyVal, val)
|
|
||||||
}
|
}
|
||||||
// Consume the closing '}'
|
// Consume the closing '}'
|
||||||
if _, err := decoder.Token(); err != nil {
|
if _, err := decoder.Token(); err != nil {
|
||||||
|
|
|
@ -41,8 +41,7 @@ func newMappingWithSize(size int) Mapping {
|
||||||
func newMappingFromGoMap(vin map[string]Value) Mapping {
|
func newMappingFromGoMap(vin map[string]Value) Mapping {
|
||||||
m := newMappingWithSize(len(vin))
|
m := newMappingWithSize(len(vin))
|
||||||
for k, v := range vin {
|
for k, v := range vin {
|
||||||
// QQQ log error or panic?
|
m.Set(V(k), v) //nolint:errcheck
|
||||||
_ = m.Set(V(k), v)
|
|
||||||
}
|
}
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
@ -145,7 +144,6 @@ func (m Mapping) Clone() Mapping {
|
||||||
// Merge merges the key-value pairs from another Mapping into the current Mapping.
|
// Merge merges the key-value pairs from another Mapping into the current Mapping.
|
||||||
func (m *Mapping) Merge(n Mapping) {
|
func (m *Mapping) Merge(n Mapping) {
|
||||||
for _, p := range n.pairs {
|
for _, p := range n.pairs {
|
||||||
// QQQ log error or panic?
|
m.Set(p.Key, p.Value) //nolint:errcheck
|
||||||
_ = m.Set(p.Key, p.Value)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,14 +88,10 @@ func mergeMap(a, b dyn.Value) (dyn.Value, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return dyn.InvalidValue, err
|
return dyn.InvalidValue, err
|
||||||
}
|
}
|
||||||
if err := out.Set(pk, merged); err != nil {
|
out.Set(pk, merged) //nolint:errcheck
|
||||||
return dyn.InvalidValue, err
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, just set the value.
|
// Otherwise, just set the value.
|
||||||
if err := out.Set(pk, pv); err != nil {
|
out.Set(pk, pv) //nolint:errcheck
|
||||||
return dyn.InvalidValue, err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,7 @@ func SetByPath(v Value, p Path, nv Value) (Value, error) {
|
||||||
|
|
||||||
// Return an updated map value.
|
// Return an updated map value.
|
||||||
m = m.Clone()
|
m = m.Clone()
|
||||||
if err := m.Set(V(component.key), nv); err != nil {
|
m.Set(V(component.key), nv) //nolint:errcheck
|
||||||
return InvalidValue, err
|
|
||||||
}
|
|
||||||
return Value{
|
return Value{
|
||||||
v: m,
|
v: m,
|
||||||
k: KindMap,
|
k: KindMap,
|
||||||
|
|
Loading…
Reference in New Issue