MCPcopy Create free account
hub / github.com/containerd/nerdctl / nonZeroMapValues

Function nonZeroMapValues

pkg/containerutil/container_network_manager.go:903–913  ·  view source on GitHub ↗

Returns a lslice of keys of the values in the map that are invalid or are a non-zero-value for their respective type. (e.g. anything other than a `""` for string type) Note that the zero-values for innately pointer-types slices/maps/chans are `nil`, and NOT a zero-length container value like `[]Any{

(values map[string]interface{})

Source from the content-addressed store, hash-verified

901// Note that the zero-values for innately pointer-types slices/maps/chans are `nil`,
902// and NOT a zero-length container value like `[]Any{}`.
903func nonZeroMapValues(values map[string]interface{}) []string {
904 nonZero := []string{}
905
906 for k, v := range values {
907 if !reflect.ValueOf(v).IsZero() {
908 nonZero = append(nonZero, k)
909 }
910 }
911
912 return nonZero
913}

Callers 3

TestZeroMapValuesFunction · 0.85
VerifyNetworkOptionsMethod · 0.85
VerifyNetworkOptionsMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestZeroMapValuesFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…