diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-03-08 06:21:54 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-08 06:21:54 -0500 |
commit | 7c09752fb88faba0cda07dbeabe17616c7262ea1 (patch) | |
tree | bd626d1310b64b2f5410a2ca8a7f5a7232634d2b /vendor/github.com/opentracing/opentracing-go/log/util.go | |
parent | b7c00f2cc03499d5d385a7aa7e8cd35d0ab994d7 (diff) | |
parent | d0d084dd8ce37141e0a2f0e9def78ffbb613ab94 (diff) | |
download | podman-7c09752fb88faba0cda07dbeabe17616c7262ea1.tar.gz podman-7c09752fb88faba0cda07dbeabe17616c7262ea1.tar.bz2 podman-7c09752fb88faba0cda07dbeabe17616c7262ea1.zip |
Merge pull request #9525 from vrothberg/prune
[NO TESTS NEEDED] Prune and debloat
Diffstat (limited to 'vendor/github.com/opentracing/opentracing-go/log/util.go')
-rw-r--r-- | vendor/github.com/opentracing/opentracing-go/log/util.go | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/vendor/github.com/opentracing/opentracing-go/log/util.go b/vendor/github.com/opentracing/opentracing-go/log/util.go deleted file mode 100644 index d57e28aa5..000000000 --- a/vendor/github.com/opentracing/opentracing-go/log/util.go +++ /dev/null @@ -1,61 +0,0 @@ -package log - -import ( - "fmt" - "reflect" -) - -// InterleavedKVToFields converts keyValues a la Span.LogKV() to a Field slice -// a la Span.LogFields(). -func InterleavedKVToFields(keyValues ...interface{}) ([]Field, error) { - if len(keyValues)%2 != 0 { - return nil, fmt.Errorf("non-even keyValues len: %d", len(keyValues)) - } - fields := make([]Field, len(keyValues)/2) - for i := 0; i*2 < len(keyValues); i++ { - key, ok := keyValues[i*2].(string) - if !ok { - return nil, fmt.Errorf( - "non-string key (pair #%d): %T", - i, keyValues[i*2]) - } - switch typedVal := keyValues[i*2+1].(type) { - case bool: - fields[i] = Bool(key, typedVal) - case string: - fields[i] = String(key, typedVal) - case int: - fields[i] = Int(key, typedVal) - case int8: - fields[i] = Int32(key, int32(typedVal)) - case int16: - fields[i] = Int32(key, int32(typedVal)) - case int32: - fields[i] = Int32(key, typedVal) - case int64: - fields[i] = Int64(key, typedVal) - case uint: - fields[i] = Uint64(key, uint64(typedVal)) - case uint64: - fields[i] = Uint64(key, typedVal) - case uint8: - fields[i] = Uint32(key, uint32(typedVal)) - case uint16: - fields[i] = Uint32(key, uint32(typedVal)) - case uint32: - fields[i] = Uint32(key, typedVal) - case float32: - fields[i] = Float32(key, typedVal) - case float64: - fields[i] = Float64(key, typedVal) - default: - if typedVal == nil || (reflect.ValueOf(typedVal).Kind() == reflect.Ptr && reflect.ValueOf(typedVal).IsNil()) { - fields[i] = String(key, "nil") - continue - } - // When in doubt, coerce to a string - fields[i] = String(key, fmt.Sprint(typedVal)) - } - } - return fields, nil -} |