Compare commits

..

No commits in common. "master" and "v4.0.20" have entirely different histories.

7 changed files with 0 additions and 135 deletions

View File

@ -31,9 +31,6 @@ func (c *cfg) Validate() error {
if c.IntValue != 10 { if c.IntValue != 10 {
return fmt.Errorf("invalid IntValue %d != %d", 10, c.IntValue) return fmt.Errorf("invalid IntValue %d != %d", 10, c.IntValue)
} }
if c.MapValue["key1"] != true {
return fmt.Errorf("invalid MapValue %t != %t", true, c.MapValue["key1"])
}
return nil return nil
} }
@ -108,19 +105,3 @@ func TestValidate(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
} }
func TestString(t *testing.T) {
cfg := config.NewConfig()
res := cfg.String()
if res != "default" {
t.Fatalf("string value invalid: %s", res)
}
}
func TestName(t *testing.T) {
cfg := config.NewConfig()
res := cfg.Name()
if res != "" {
t.Fatal("name value not empty")
}
}

View File

@ -1,36 +0,0 @@
package flow
import (
"reflect"
"testing"
)
func FuzzMarshall(f *testing.F) {
f.Fuzz(func(t *testing.T, ref []byte) {
rm := RawMessage(ref)
b, err := rm.MarshalJSON()
if err != nil {
t.Errorf("Error MarshalJSON: %s", err)
}
if !reflect.DeepEqual(ref, b) {
t.Errorf("Error. Expected '%s', was '%s'", ref, b)
}
})
}
func FuzzUnmarshall(f *testing.F) {
f.Fuzz(func(t *testing.T, ref string) {
b := []byte(ref)
rm := RawMessage(b)
if err := rm.UnmarshalJSON(b); err != nil {
t.Errorf("Error UnmarshalJSON: %s", err)
}
if ref != string(rm) {
t.Errorf("Error. Expected '%s', was '%s'", ref, rm)
}
})
}

View File

@ -214,20 +214,6 @@ func WithMicroKeys() options.Option {
} }
} }
// WithAddCallerSkipCount add skip count for copy logger
func WithAddCallerSkipCount(n int) options.Option {
return func(src interface{}) error {
c, err := options.Get(src, ".CallerSkipCount")
if err != nil {
return err
}
if err = options.Set(src, c.(int)+n, ".CallerSkipCount"); err != nil {
return err
}
return nil
}
}
// WithAddStacktrace controls writing stacktrace on error // WithAddStacktrace controls writing stacktrace on error
func WithAddStacktrace(v bool) options.Option { func WithAddStacktrace(v bool) options.Option {
return func(src interface{}) error { return func(src interface{}) error {

View File

@ -17,6 +17,4 @@ var (
SubscribeMessageTotal = "subscribe_message_total" SubscribeMessageTotal = "subscribe_message_total"
// SubscribeMessageInflight specifies meter metric name // SubscribeMessageInflight specifies meter metric name
SubscribeMessageInflight = "subscribe_message_inflight" SubscribeMessageInflight = "subscribe_message_inflight"
// BrokerGroupLag specifies broker lag
BrokerGroupLag = "broker_lag"
) )

View File

@ -1,12 +0,0 @@
package semconv
var (
// CacheRequestDurationSeconds specifies meter metric name
CacheRequestDurationSeconds = "cache_request_duration_seconds"
// ClientRequestLatencyMicroseconds specifies meter metric name
CacheRequestLatencyMicroseconds = "cache_request_latency_microseconds"
// CacheRequestTotal specifies meter metric name
CacheRequestTotal = "cache_request_total"
// CacheRequestInflight specifies meter metric name
CacheRequestInflight = "cache_request_inflight"
)

View File

@ -1,25 +0,0 @@
package pool
import "sync"
type Pool[T any] struct {
p *sync.Pool
}
func NewPool[T any](fn func() T) Pool[T] {
return Pool[T]{
p: &sync.Pool{
New: func() interface{} {
return fn()
},
},
}
}
func (p Pool[T]) Get() T {
return p.p.Get().(T)
}
func (p Pool[T]) Put(t T) {
p.p.Put(t)
}

View File

@ -1,27 +0,0 @@
package pool
import (
"bytes"
"strings"
"testing"
)
func TestBytes(t *testing.T) {
p := NewPool(func() *bytes.Buffer { return bytes.NewBuffer(nil) })
b := p.Get()
b.Write([]byte(`test`))
if b.String() != "test" {
t.Fatal("pool not works")
}
p.Put(b)
}
func TestStrings(t *testing.T) {
p := NewPool(func() *strings.Builder { return &strings.Builder{} })
b := p.Get()
b.Write([]byte(`test`))
if b.String() != "test" {
t.Fatal("pool not works")
}
p.Put(b)
}