update opentelemetry version (#6)
Co-authored-by: andrey1s <andrey@4devs.pro> Reviewed-on: #6 Co-authored-by: andrey <andrey@4devs.io> Co-committed-by: andrey <andrey@4devs.io>
This commit was merged in pull request #6.
This commit is contained in:
@@ -2,6 +2,7 @@ package field
|
||||
|
||||
import "time"
|
||||
|
||||
//nolint:interfacebloat
|
||||
type Encoder interface {
|
||||
// Built-in types.
|
||||
AddArray(key string, value Value)
|
||||
|
||||
@@ -255,13 +255,13 @@ type Field struct {
|
||||
value Value
|
||||
}
|
||||
|
||||
//nolint: gocyclo,cyclop
|
||||
//nolint:gocyclo,cyclop
|
||||
func (f Field) AddTo(enc Encoder) {
|
||||
key := string(f.key)
|
||||
|
||||
switch {
|
||||
case f.value.IsArray():
|
||||
enc.AddAny(key, f.value)
|
||||
enc.AddArray(key, f.value)
|
||||
case f.value.IsNil():
|
||||
enc.AddNil(key)
|
||||
case f.value.IsBool():
|
||||
|
||||
@@ -3,7 +3,6 @@ package field_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"gitoa.ru/go-4devs/log/field"
|
||||
)
|
||||
|
||||
@@ -13,5 +12,7 @@ func TestFields_Append(t *testing.T) {
|
||||
fields := field.Fields{field.Any("any", "value")}
|
||||
fields = fields.Append(field.String("string", "value"))
|
||||
|
||||
require.Len(t, fields, 2)
|
||||
if len(fields) != 2 {
|
||||
t.Fatalf("require 2 field got %v", len(fields))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
type Key string
|
||||
|
||||
//nolint: gocyclo,funlen,cyclop
|
||||
//nolint:funlen,cyclop,gocyclo
|
||||
func (k Key) Any(value interface{}) Field {
|
||||
switch val := value.(type) {
|
||||
case string:
|
||||
|
||||
@@ -24,7 +24,7 @@ func (v Value) MarshalJSON() ([]byte, error) {
|
||||
return b, nil
|
||||
}
|
||||
|
||||
//nolint: gocyclo,gomnd,cyclop
|
||||
//nolint:gocyclo,gomnd,cyclop
|
||||
func (v Value) String() string {
|
||||
switch {
|
||||
case v.vtype.IsArray(), v.vtype.IsAny():
|
||||
@@ -62,7 +62,7 @@ func (v Value) String() string {
|
||||
return fmt.Sprintf("%+v", v.AsInterface())
|
||||
}
|
||||
|
||||
//nolint: gocyclo,cyclop
|
||||
//nolint:gocyclo,cyclop
|
||||
func (v Value) AsInterface() interface{} {
|
||||
switch {
|
||||
case v.vtype.IsArray():
|
||||
|
||||
Reference in New Issue
Block a user