many fixes for lint and context.Context usage (#5)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
@@ -2,24 +2,34 @@ package tracer
|
||||
|
||||
import "context"
|
||||
|
||||
type NoopTracer struct{}
|
||||
type noopTracer struct {
|
||||
opts Options
|
||||
}
|
||||
|
||||
func (n *NoopTracer) Init(...Option) error {
|
||||
// Init initilize tracer
|
||||
func (n *noopTracer) Init(opts ...Option) error {
|
||||
for _, o := range opts {
|
||||
o(&n.opts)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *NoopTracer) Start(ctx context.Context, name string) (context.Context, *Span) {
|
||||
// Start starts new span
|
||||
func (n *noopTracer) Start(ctx context.Context, name string) (context.Context, *Span) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (n *NoopTracer) Finish(*Span) error {
|
||||
// Finish finishes span
|
||||
func (n *noopTracer) Finish(*Span) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *NoopTracer) Read(...ReadOption) ([]*Span, error) {
|
||||
// Read reads span
|
||||
func (n *noopTracer) Read(...ReadOption) ([]*Span, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// NewTracer returns new noop tracer
|
||||
func NewTracer(opts ...Option) Tracer {
|
||||
return &NoopTracer{}
|
||||
return &noopTracer{opts: NewOptions(opts...)}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user